Skip to content

Instantly share code, notes, and snippets.

@miholeus
Created August 16, 2017 09:42
Show Gist options
  • Save miholeus/d18b2e358927bdb8944996621ddbceb2 to your computer and use it in GitHub Desktop.
Save miholeus/d18b2e358927bdb8944996621ddbceb2 to your computer and use it in GitHub Desktop.
PHPMD rulesets
<?xml version="1.0"?>
<ruleset name="My first PHPMD rule set"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0
http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Project rule sets
</description>
<!-- Import the entire unused code rule set -->
<rule ref="rulesets/unusedcode.xml" />
<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>
<!-- Import the entire cyclomatic complexity rule -->
<rule ref="rulesets/codesize.xml/CyclomaticComplexity" />
<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>
<properties>
<property name="minimum" value="5" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessivePublicCount">
<priority>2</priority>
<properties>
<property name="minimum" value="25" />
</properties>
</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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment