Repository navigation
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
150 lines (129 loc) · 5.11 KB
/
Copy pathphpcs.xml.dist
File metadata and controls
150 lines (129 loc) · 5.11 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
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
145
146
147
148
149
150
<?xml version="1.0"?>
<ruleset name="MHM Currency Switcher">
<description>Custom ruleset for MHM Currency Switcher plugin.</description>
<!--
Scan these files.
🔴 The rule is: every PHP file that SHIPS is in the scan list. A file
left out of scope is a suppression that nobody wrote down — a
`phpcs:ignore` with no comment and no grep to find it. Proven, not
assumed: with `echo $_GET[...]` planted in the generated file below,
this gate reported 0 ERRORS while the stock WordPress standard
reported 4 ERRORS (EscapeOutput.OutputNotEscaped,
ValidatedSanitizedInput.{InputNotValidated,MissingUnslash,InputNotSanitized}).
Compare against the shipped list, not against this file: the ZIP is
what a reviewer reads.
-->
<file>./src/</file>
<file>./mhm-currency-switcher.php</file>
<file>./uninstall.php</file>
<!--
Generated files that ship. They are in scope so the security sniffs can
reach them; their stylistic noise is answered BY RULE below, never by
dropping them back out of scope.
-->
<file>./admin-app/build/index.asset.php</file>
<!--
Exclude paths.
`/admin-app/src/*` — the React source, not shipped (.distignore drops
it). Note this is deliberately NARROWER than the `/admin-app/*` it
replaces: that pattern also hid admin-app/build/index.asset.php, which
DOES ship, and hid it so thoroughly that naming the file on the command
line still skipped it.
-->
<exclude-pattern>/vendor/*</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<exclude-pattern>/admin-app/src/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
<!-- Show progress and sniff codes -->
<arg value="ps"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<!-- WordPress rulesets -->
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>
<!--
Formatting sniffs held off the GENERATED shipped file: webpack writes
admin-app/build/index.asset.php. Its spacing and missing file docblock
are not ours to fix, and regenerating would undo any fix.
🔴 The exclusions are per SNIFF, never per ruleset. An exclude-pattern
attached to `WordPress-Extra` reaches every sniff that ruleset can
reach, and EscapeOutput is one of them: it went silent on the file
and re-registering `WordPress.Security` afterwards did NOT bring it
back (patterns accumulate on a sniff, they do not reset). That is the
one sniff this project can least afford to lose. Measured, not assumed
— the planted-probe run is in the header comment above.
This list is the measured noise set (9 error codes, 7 sniffs). Anything
NOT named here still applies to those files, security sniffs included.
-->
<rule ref="WordPress.WhiteSpace.OperatorSpacing">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<rule ref="Universal.WhiteSpace.CommaSpacing">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<rule ref="NormalizedArrays.Arrays.ArrayBraceSpacing">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<rule ref="WordPress.Arrays.ArrayDeclarationSpacing">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<rule ref="Universal.Arrays.DisallowShortArraySyntax">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<rule ref="PSR2.Files.EndFileNewline">
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<!-- Allow PSR-4 file naming in src/ directory -->
<rule ref="WordPress.Files.FileName">
<exclude-pattern>./src/*</exclude-pattern>
<exclude-pattern>./admin-app/build/*</exclude-pattern>
</rule>
<!-- Allow reserved keywords as parameter names (e.g. $class in autoloader) -->
<rule ref="Universal.NamingConventions.NoReservedKeywordParameterNames">
<severity>0</severity>
</rule>
<!--
WordPress security rules.
Registered WITHOUT an exclude-pattern, on purpose: these are the sniffs
that must be able to see every shipped file, generated or not.
-->
<rule ref="WordPress.Security"/>
<rule ref="WordPress.DB"/>
<!--
WooCommerce capabilities are unknown to the WordPress core sniff, which
reports them as possible typos. Declaring them here answers the sniff
honestly instead of silencing it with an inline suppression — a
suppression would also hide a REAL typo in the same call.
-->
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="manage_woocommerce"/>
</property>
</properties>
</rule>
<!-- Prefixes -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="mhmcs"/>
<element value="MhmCurrencySwitcher"/>
</property>
</properties>
</rule>
<!-- Text domain -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="mhm-currency-switcher"/>
</property>
</properties>
</rule>
<!-- Minimum WordPress version -->
<config name="minimum_wp_version" value="6.6"/>
<!-- PHP compatibility -->
<config name="testVersion" value="7.4-"/>
</ruleset>