-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathphpcs.xml.dist
144 lines (120 loc) · 5.12 KB
/
phpcs.xml.dist
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?xml version="1.0"?>
<ruleset name="MWPD Basic Scaffold">
<description>Custom coding standards for MWPD Basic Scaffold</description>
<!-- What to scan -->
<file>src</file>
<file>tests</file>
<file>views</file>
<!-- Exclude patterns -->
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<!-- How to scan -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/>
<!-- Rules: WordPress Coding Standards -->
<config name="minimum_supported_wp_version" value="6.0"/>
<rule ref="WordPress">
<!-- Allow modern array syntax -->
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<!-- Allow short ternary operator -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
<!-- Allow PSR-4 class names -->
<exclude name="WordPress.Files.FileName"/>
<!-- Allow proper case for class names -->
<exclude name="PEAR.NamingConventions.ValidClassName"/>
<!-- Allow exceptions not escaped -->
<exclude name="WordPress.Security.EscapeOutput.ExceptionNotEscaped"/>
<!-- Allow short ternary operator -->
<exclude name="Universal.Operators.DisallowShortTernary"/>
<!-- Allow underscore prefix for the _context_ property -->
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
<!-- Allow short open tags -->
<exclude name="Generic.PHP.DisallowShortOpenTag"/>
<!-- Allow short open echo tag without semicolon -->
<exclude name="Squiz.PHP.EmbeddedPhp.ShortOpenEchoNoSemicolon"/>
<!-- Don't enforce Yoda conditions -->
<exclude name="WordPress.PHP.YodaConditions"/>
</rule>
<!-- Rules: PHP version compatibility -->
<config name="testVersion" value="7.4-"/>
<rule ref="PHPCompatibility"/>
<!-- Rules: Customizations -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<!-- Allow short array syntax -->
<rule ref="Generic.Arrays.DisallowShortArraySyntax.Found">
<severity>0</severity>
</rule>
<!-- Enforce PSR-4 style class names -->
<rule ref="Squiz.Classes.ValidClassName">
<severity>5</severity>
</rule>
<!-- Set line length -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<!-- Enforce proper docblock alignment -->
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<!-- Don't enforce missing variable type in docblocks, as we're using strict typing -->
<rule ref="Squiz.Commenting.VariableComment.MissingVar">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.VariableComment.Missing">
<severity>0</severity>
</rule>
<!-- Verify that all class properties have their visibility declared -->
<rule ref="PSR2.Classes.PropertyDeclaration"/>
<!-- Mark the View::render() method as an escaping function
Note: This does NOT work yet, waiting for
https://github.com/WordPress/WordPress-Coding-Standards/pull/2370
to be merged. -->
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array">
<element value="MWPD\BasicScaffold\View::render"/>
</property>
</properties>
</rule>
<!-- Don't enforce PSR-12 file header for view files -->
<rule ref="PSR12.Files.FileHeader">
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<!-- Customize rules for test files -->
<rule ref="Squiz.Commenting.FunctionComment">
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment">
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.ClassComment">
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="Generic.Commenting.DocComment">
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName">
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="WordPress.Security.EscapeOutput">
<exclude-pattern>/tests/php/Fixture/views/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="Internal.NoCodeFound">
<exclude-pattern>/tests/php/Fixture/views/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
<rule ref="Generic.PHP.Syntax">
<exclude-pattern>/tests/php/Fixture/views/*</exclude-pattern>
<exclude-pattern>/views/*</exclude-pattern>
</rule>
</ruleset>