Repository navigation
Expand file tree
/
Copy pathphpmd.xml
More file actions
61 lines (51 loc) · 2.48 KB
/
Copy pathphpmd.xml
File metadata and controls
61 lines (51 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="WordPress Plugin PHPMD Ruleset"
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>WordPress-compatible PHPMD ruleset for code quality and naming conventions.</description>
<!--
Non-production paths. The composer script and the CI job pass the same
list on the command line.
-->
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/.private/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/stubs/*</exclude-pattern>
<!-- Clean Code Rules (with WordPress exceptions) -->
<rule ref="rulesets/cleancode.xml">
<!-- WordPress code uses core classes without namespace imports. -->
<exclude name="MissingImport"/>
</rule>
<!-- Code Size Rules (default thresholds) -->
<rule ref="rulesets/codesize.xml"/>
<!-- Controversial Rules (with WordPress naming exceptions) -->
<rule ref="rulesets/controversial.xml">
<!-- WordPress uses snake_case and Snake_Case_Class_Names. -->
<exclude name="CamelCaseClassName"/>
<exclude name="CamelCaseMethodName"/>
<exclude name="CamelCaseVariableName"/>
<exclude name="CamelCaseParameterName"/>
<exclude name="CamelCasePropertyName"/>
</rule>
<!-- Design Rules -->
<rule ref="rulesets/design.xml"/>
<!-- Naming Rules. The camelCase rules are in the controversial ruleset. -->
<rule ref="rulesets/naming.xml">
<!-- LongVariable is added again below, and LongMethodName in phpmd-extra.xml, with limits that
fit prefixed WordPress names. LongMethodName is a PHPMD 3 rule; Codacy reads this file
with PHPMD 2, which stops on a rule it does not know. -->
<exclude name="LongVariable"/>
<exclude name="LongMethodName"/>
</rule>
<rule ref="rulesets/naming.xml/LongVariable">
<properties>
<!-- Global variables start with the plugin prefix; the longest name has 31 characters. -->
<property name="maximum" value="35"/>
</properties>
</rule>
<!-- Unused Code Rules (always enforce) -->
<rule ref="rulesets/unusedcode.xml"/>
</ruleset>