Repository navigation
Expand file tree
/
Copy pathphpmd.xml
More file actions
68 lines (57 loc) · 2.69 KB
/
Copy pathphpmd.xml
File metadata and controls
68 lines (57 loc) · 2.69 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
62
63
64
65
66
67
68
<?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>*/assets/*</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"/>
<!-- Added again below, with the one class that is reached statically. -->
<exclude name="StaticAccess"/>
</rule>
<rule ref="rulesets/cleancode.xml/StaticAccess">
<properties>
<!-- The plugin coordinator is reached through its static instance() accessor. -->
<property name="exceptions" value="Optimizations_Ace_Mc"/>
</properties>
</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">
<!-- Added again below with a limit that fits prefixed WordPress names. -->
<exclude name="LongClassName"/>
</rule>
<rule ref="rulesets/naming.xml/LongClassName">
<properties>
<!-- Class names start with the plugin prefix; the longest has 46 characters. -->
<property name="maximum" value="50"/>
</properties>
</rule>
<!-- Unused Code Rules (always enforce) -->
<rule ref="rulesets/unusedcode.xml"/>
</ruleset>