title: How to ignore specific rule for specific directory in PHPMD
body: <p><strong>command</strong></p>
  <pre><code>phpmd app,config,routes text phpmd.xml
  </code></pre>
  <p>I use phpmd on Laravel project, there is a rule named <code>CouplingBetweenObjects</code> under design.xml, I want to ignore all files in app/Http/Controllers directory to this rule, phpmd only provide <code>--exclude</code> option which will make the directory pass <strong>ALL</strong> rules, is it possible to ignore a rule to specific directory either by XML file or command line</p>
  <p><strong>phpmd.xml</strong></p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;ruleset name=&quot;Netask rule set&quot;
      xmlns=&quot;http://pmd.sf.net/ruleset/1.0.0&quot;
      xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
      xsi:schemaLocation=&quot;http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd&quot;
      xsi:noNamespaceSchemaLocation=&quot;http://pmd.sf.net/ruleset_xml_schema.xsd&quot;&gt;
  &lt;description&gt;Netask code style rule set
  &lt;/description&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/CyclomaticComplexity&quot;/&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/NPathComplexity&quot;/&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/ExcessiveMethodLength&quot;/&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/ExcessiveClassLength&quot;/&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/ExcessiveParameterList&quot;/&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/ExcessivePublicCount&quot;&gt;
      &lt;properties&gt;
          &lt;property name=&quot;minimum&quot; value=&quot;30&quot;/&gt;
      &lt;/properties&gt;
  &lt;/rule&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/TooManyFields&quot;&gt;
      &lt;properties&gt;
          &lt;property name=&quot;maxfields&quot; value=&quot;20&quot;/&gt;
      &lt;/properties&gt;
  &lt;/rule&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/TooManyMethods&quot;/&gt;
  &lt;rule ref=&quot;rulesets/codesize.xml/ExcessiveClassComplexity&quot;&gt;
      &lt;properties&gt;
          &lt;property name=&quot;maximum&quot; value=&quot;30&quot;/&gt;
      &lt;/properties&gt;
  &lt;/rule&gt;
  &lt;rule ref=&quot;rulesets/controversial.xml&quot;/&gt;
  &lt;rule ref=&quot;rulesets/design.xml&quot;/&gt;
  &lt;rule ref=&quot;rulesets/naming.xml/ShortVariable&quot;/&gt;
  &lt;rule ref=&quot;rulesets/naming.xml/LongVariable&quot;&gt;
      &lt;properties&gt;
          &lt;property name=&quot;maximum&quot; value=&quot;30&quot;/&gt;
      &lt;/properties&gt;
  &lt;/rule&gt;
  &lt;rule ref=&quot;rulesets/naming.xml/ShortMethodName&quot;&gt;
      &lt;properties&gt;
          &lt;property name=&quot;minimum&quot; value=&quot;2&quot;/&gt;
      &lt;/properties&gt;
  &lt;/rule&gt;
  &lt;rule ref=&quot;rulesets/naming.xml/ConstructorWithNameAsEnclosingClass&quot;/&gt;
  &lt;rule ref=&quot;rulesets/naming.xml/ConstantNamingConventions&quot;/&gt;
  &lt;rule ref=&quot;rulesets/naming.xml/BooleanGetMethodName&quot;/&gt;
  &lt;rule ref=&quot;rulesets/unusedcode.xml/UnusedPrivateField&quot; /&gt;
  &lt;rule ref=&quot;rulesets/unusedcode.xml/UnusedLocalVariable&quot; /&gt;
  
  &lt;exclude-pattern&gt;app/Console/Kernel.php&lt;/exclude-pattern&gt;
  &lt;exclude-pattern&gt;app/Services/Service.php&lt;/exclude-pattern&gt;
  &lt;exclude-pattern&gt;tests/TestCase.php&lt;/exclude-pattern&gt;
  &lt;/ruleset&gt;
  </code></pre>