Exemple d’un fichier ruleset.xml pour §PHPMD

Documentation : https://phpmd.org/documentation/creating-a-ruleset.html

<?xml version="1.0"?>
<ruleset name="MarkNotes">
  <description>MarkNotes specific PHP-CS rules</description>
  <arg name="tab-width" value="4"></arg>
  <rule ref="rulesets/controversial.xml">
    <exclude name="CamelCaseMethodName"></exclude>
  </rule>
  <rule ref="rulesets/unusedcode.xml/UnusedPrivateField" />
  <rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod" />
  <rule ref="rulesets/unusedcode.xml/UnusedFormalParameter" />
  <rule ref="rulesets/naming.xml/LongVariable">
    <priority>5</priority>
    <properties>
      <property name="maximum" value="30" />
    </properties>
  </rule>
  <rule ref="rulesets/naming.xml/ShortMethodName" />
  <rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass" />
  <rule ref="rulesets/naming.xml/ConstantNamingConventions" />
  <rule ref="rulesets/naming.xml/BooleanGetMethodName">
    <priority>5</priority>
  </rule>
  <rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
  <rule ref="rulesets/codesize.xml/NPathComplexity" />
  <rule ref="rulesets/codesize.xml/ExcessiveMethodLength" />
  <rule ref="rulesets/codesize.xml/ExcessiveClassLength">
    <properties>
      <property name="minimum" value="1500" />
    </properties>
  </rule>
  <rule ref="rulesets/codesize.xml/ExcessiveParameterList">
    <priority>2</priority>
  </rule>
  <rule ref="rulesets/codesize.xml/ExcessivePublicCount">
    <priority>2</priority>
  </rule>
  <rule ref="rulesets/codesize.xml/TooManyFields">
    <priority>4</priority>
    <properties>
      <property name="maxfields" value="20" />
    </properties>
  </rule>
  <rule ref="rulesets/codesize.xml/TooManyMethods">
    <priority>3</priority>
    <properties>
      <property name="maxmethods" value="30" />
    </properties>
  </rule>
  <rule ref="rulesets/codesize.xml/ExcessiveClassComplexity" />
</ruleset>