configs/phpmd.xml
<?xml version="1.0"?>
<ruleset name="Drupal ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0
http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
xsi:noNamespaceSchemaLocation="
http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>
Ruleset for PHPMD analysis of Drupal projects. Excludes coding issues
handled better by PHPCS and rules which have too many false positives
in a typical Drupal codebase.
</description>
<rule ref="rulesets/cleancode.xml">
<!--
Validated by PHPCS and is in conflict with the DrupalPractices sniffs.
-->
<exclude name="MissingImport"/>
<!--
PHPMD is not smart enough to see the difference between static access and
named constructors.
-->
<exclude name="StaticAccess"/>
</rule>
<rule ref="rulesets/codesize.xml"/>
<rule ref="rulesets/design.xml"/>
<rule ref="rulesets/naming.xml">
<exclude name="ShortMethodName"/>
<exclude name="ShortVariable"/>
</rule>
<rule ref="rulesets/naming.xml/ShortMethodName">
<!--
Allow "id()" as a short method name.
-->
<properties>
<property name="minimum" value="2"/>
<property name="exceptions" value="id"/>
</properties>
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<!--
Allow "$id" as a short variable name.
-->
<properties>
<property name="minimum" value="2"/>
<property name="exceptions" value="id"/>
</properties>
</rule>
<rule ref="rulesets/unusedcode.xml">
<exclude name="UnusedFormalParameter"/>
</rule>
</ruleset>