Skip to content

Instantly share code, notes, and snippets.

@iggyster
Created March 31, 2018 17:28
Show Gist options
  • Save iggyster/0c6f564ab9f875da8a2d5d9b2b2cb776 to your computer and use it in GitHub Desktop.
Save iggyster/0c6f564ab9f875da8a2d5d9b2b2cb776 to your computer and use it in GitHub Desktop.
PHP MD Configuration
<?xml version="1.0"?>
<ruleset name="Name">
<description>Name - PHP MD Ruleset</description>
<!-- CLEAN CODE RULES: http://phpmd.org/rules/cleancode.html -->
<rule ref="rulesets/cleancode.xml/BooleanArgumentFlag"/>
<rule ref="rulesets/cleancode.xml/ElseExpression"/>
<rule ref="rulesets/cleancode.xml/StaticAccess"/>
<!-- CODE SIZE RULES: http://phpmd.org/rules/codesize.html -->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<priority>1</priority>
<properties>
<property name="reportLevel" value="10"/>
<property name="showClassesComplexity" value="true"/>
<property name="showMethodsComplexity" value="true"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
<priority>1</priority>
<properties>
<property name="minimum" value="100"/>
<property name="ignore-whitespace" value="true"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassLength">
<priority>1</priority>
<properties>
<property name="minimum" value="1000"/>
<property name="ignore-whitespace" value="true"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList">
<priority>1</priority>
<properties>
<property name="minimum" value="7"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessivePublicCount">
<priority>1</priority>
<properties>
<property name="minimum" value="45"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyFields">
<priority>1</priority>
<properties>
<property name="maxfields" value="15"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods">
<priority>1</priority>
<properties>
<property name="maxmethods" value="25"/>
<property name="ignorepattern" value="(^(set|get))i"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
<priority>1</priority>
<properties>
<property name="maxmethods" value="10"/>
<property name="ignorepattern" value="(^(set|get))i"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity">
<priority>1</priority>
<properties>
<property name="maximum" value="50"/>
</properties>
</rule>
<!-- CONTROVERSIAL RULES: http://phpmd.org/rules/controversial.html -->
<rule ref="rulesets/controversial.xml/Superglobals"/>
<rule ref="rulesets/controversial.xml/CamelCaseClassName"/>
<rule ref="rulesets/controversial.xml/CamelCasePropertyName">
<priority>1</priority>
<properties>
<property name="allow-underscore" value="true"/>
<property name="allow-underscore-test" value="true"/>
</properties>
</rule>
<rule ref="rulesets/controversial.xml/CamelCaseMethodName">
<priority>1</priority>
<properties>
<property name="allow-underscore" value="false"/>
<property name="allow-underscore-test" value="false"/>
</properties>
</rule>
<rule ref="rulesets/controversial.xml/CamelCaseParameterName"/>
<rule ref="rulesets/controversial.xml/CamelCaseVariableName"/>
<!-- DESIGN RULES: http://phpmd.org/rules/design.html -->
<rule ref="rulesets/design.xml/ExitExpression"/>
<rule ref="rulesets/design.xml/EvalExpression"/>
<rule ref="rulesets/design.xml/GotoStatement"/>
<rule ref="rulesets/design.xml/NumberOfChildren">
<priority>1</priority>
<properties>
<property name="minimum" value="15"/>
</properties>
</rule>
<rule ref="rulesets/design.xml/DepthOfInheritance">
<priority>1</priority>
<properties>
<property name="minimum" value="6"/>
</properties>
</rule>
<rule ref="rulesets/design.xml/CouplingBetweenObjects">
<priority>1</priority>
<properties>
<property name="minimum" value="13"/>
</properties>
</rule>
<rule ref="rulesets/design.xml/DevelopmentCodeFragment"/>
<!-- NAMING RULES: http://phpmd.org/rules/naming.html -->
<rule ref="rulesets/naming.xml/ShortVariable">
<priority>1</priority>
<properties>
<property name="minimum" value="3"/>
<property name="exceptions" value="id,em"/>
</properties>
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<priority>1</priority>
<properties>
<property name="minimum" value="20"/>
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName">
<priority>1</priority>
<properties>
<property name="minimum" value="3"/>
<property name="exceptions" value="id,em"/>
</properties>
</rule>
<rule ref="rulesets/naming.xml/ConstructorWithNameAsEnclosingClass"/>
<rule ref="rulesets/naming.xml/ConstantNamingConventions"/>
<rule ref="rulesets/naming.xml/BooleanGetMethodName">
<priority>1</priority>
<properties>
<property name="checkParameterizedMethods" value="true"/>
</properties>
</rule>
<!-- UNUSED CODE RULES: http://phpmd.org/rules/unusedcode.html -->
<rule ref="rulesets/unusedcode.xml/UnusedPrivateField"/>
<rule ref="rulesets/unusedcode.xml/UnusedLocalVariable">
<priority>1</priority>
<properties>
<property name="allow-unused-foreach-variables" value="false"/>
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml/UnusedPrivateMethod"/>
<rule ref="rulesets/unusedcode.xml/UnusedFormalParameter"/>
</ruleset>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment