-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
phpmd.xml
81 lines (76 loc) · 2.94 KB
/
phpmd.xml
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
69
70
71
72
73
74
75
76
77
78
79
80
81
<?xml version="1.0"?>
<ruleset name="WordPress VAA"
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>VAA Standards</description>
<!-- Design -->
<rule ref="rulesets/design.xml">
<!-- Normal in WP for redirects, etc -->
<exclude name="ExitExpression" />
<!-- Disable for now due to toolbar methods -->
<exclude name="LongMethod" />
</rule>
<!-- CleanCode -->
<rule ref="rulesets/cleancode.xml">
<!-- Used all over (The method "" has a boolean flag argument "", which is a certain sign of a Single Responsibility Principle violation.) -->
<exclude name="BooleanArgumentFlag" />
<!-- In lack of real namespacing (Avoid using static access to class '' in method ''.) -->
<exclude name="StaticAccess" />
<!-- I do not agree with this, only very long if/else expressions -->
<exclude name="ElseExpression" />
</rule>
<!-- CodeSize -->
<rule ref="rulesets/codesize.xml">
<!-- Defined below for custom config -->
<exclude name="ExcessiveClassComplexity" />
<exclude name="ExcessiveMethodLength" />
<exclude name="ExcessiveClassLength" />
<exclude name="TooManyMethods" />
<exclude name="TooManyPublicMethods" />
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
<properties>
<!-- Just check the actual code ok.. CodeSniffer already checks whitespace/newline errors -->
<property name="ignore-whitespace" value="true" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassLength">
<properties>
<!-- Just check the actual code ok.. CodeSniffer already checks whitespace/newline errors -->
<property name="ignore-whitespace" value="true" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyMethods">
<properties>
<!-- Ignore magic methods, getters and setters -->
<property name="ignorepattern" value="(^(set|get|__))i" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/TooManyPublicMethods">
<properties>
<!-- Allow more public methods because WP hooks force the use of public methods. Default: 10 -->
<property name="maxmethods" value="20" />
<!-- Ignore magic methods, getters and setters -->
<property name="ignorepattern" value="(^(set|get|__))i" />
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveClassComplexity">
<properties>
<!-- Allow higher overall class complexity. Default: 50 -->
<property name="maximum" value="100" />
</properties>
</rule>
<!-- Naming -->
<rule ref="rulesets/naming.xml">
<!-- Defined below for custom config -->
<exclude name="ShortVariable"/>
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<!-- common in WP and VAA -->
<property name="exceptions" value="id,wp,ui" />
</properties>
</rule>
</ruleset>