This repository was archived by the owner on Feb 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
204 lines (179 loc) · 8.28 KB
/
phpcs.xml.dist
File metadata and controls
204 lines (179 loc) · 8.28 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?xml version="1.0"?>
<ruleset
name="WPCS - Abilities API"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"
>
<description>Sniffs for Abilities API plugin</description>
<!-- What to scan: include any root-level PHP files, and the /inc folder -->
<file>./includes/</file>
<file>./abilities-api.php</file>
<!-- These are excluded from the above paths.-->
<exclude-pattern>**/build/**</exclude-pattern>
<exclude-pattern>**/node_modules/**</exclude-pattern>
<exclude-pattern>**/vendor/**</exclude-pattern>
<!-- How to scan: include CLI args so you don't need to pass them manually -->
<!-- Usage instructions: https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Usage -->
<!-- Annotated ruleset:
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- Show sniff and progress -->
<arg value="sp" />
<!-- Strip the file paths down to the relevant bit -->
<arg name="basepath" value="./" />
<!-- Enable colors in report -->
<arg name="colors" />
<!-- Only lint php files by default -->
<arg name="extensions" value="php" />
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next
scan. -->
<arg name="cache" value="tests/_output/phpcs-cache.json" />
<!-- Enables parallel processing when available for faster results. -->
<arg name="parallel" value="20" />
<!-- Set severity to 1 to see everything that isn't effectively turned off. -->
<arg name="severity" value="1" />
<!-- Ruleset Config: set these to match your project constraints. -->
<!--
Tests for PHP version compatibility.
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards#Recomended-additional-rulesets
-->
<config name="testVersion" value="7.2-" />
<!--
Tests for WordPress version compatibility.
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties
-->
<config name="minimum_wp_version" value="6.8" />
<!--
Load WordPress VIP Go standards
We do this first, since we don't trust them to disable rules that we want to use.
@see: https://docs.wpvip.com/technical-references/vip-code-analysis-bot/phpcs-report/
-->
<rule ref="WordPress-VIP-Go">
<!-- Deprecated: @todo remove in PHPCS 4.0 -->
<exclude name="WordPressVIPMinimum.JS" />
</rule>
<rule ref="WordPress-Extra">
<exclude name="WordPress.WP.I18n.MissingArgDomain" />
<exclude name="WordPress.Security.EscapeOutput"/>
<!-- Needed to typehint, see: https://github.com/WordPress/WordPress-Coding-Standards/issues/403 -->
<exclude name="Generic.Commenting.DocComment.MissingShort" />
</rule>
<!--
Load PHPCompatibility & PHPCompatibilityWP
@see: https://github.com/PHPCompatibility/PHPCompatibilityWP
-->
<rule ref="PHPCompatibilityWP" />
<!--
Checks from PCP
@see https://github.com/wordpress/plugin-check
-->
<rule
ref="./vendor/wpackagist-plugin/plugin-check/vendor/plugin-check/phpcs-sniffs/PluginCheck/ruleset.xml" />
<rule ref="./vendor/wpackagist-plugin/plugin-check/phpcs-rulesets/plugin-check.ruleset.xml" />
<!-- Check for superfluous whitespace - These get suppressed in VIP-GO.-->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<severity>5</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines">
<severity>5</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine">
<severity>5</severity>
</rule>
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
<properties>
<property name="blank_line_check" value="true" />
</properties>
</rule>
<!--
Slevomat Coding Standards to keep our code clean and modern.
See: https://github.com/slevomat/coding-standard/tree/master#alphabetical-list-of-sniffs
-->
<rule ref="SlevomatCodingStandard.Arrays.ArrayAccess" />
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation" />
<rule ref="SlevomatCodingStandard.Arrays.MultiLineArrayEndBracketPlacement" />
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility" />
<rule ref="SlevomatCodingStandard.Classes.DisallowConstructorPropertyPromotion" />
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants" />
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiConstantDefinition" />
<rule ref="SlevomatCodingStandard.Classes.DisallowMultiPropertyDefinition" />
<rule ref="SlevomatCodingStandard.Classes.DisallowStringExpressionPropertyFetch" />
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference">
<properties>
<!-- Doesn't use PHPCompatibility-->
<property name="enableOnObjects" value="false" />
</properties>
<exclude name="SlevomatCodingStandard.Classes.ModernClassNameReference.ClassNameReferencedViaMagicConstant"/>
</rule>
<rule ref="SlevomatCodingStandard.Classes.RequireSelfReference" />
<rule ref="SlevomatCodingStandard.Classes.UselessLateStaticBinding" />
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowContinueWithoutIntegerOperandInSwitch" />
<rule ref="SlevomatCodingStandard.ControlStructures.EarlyExit" />
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn" />
<rule ref="SlevomatCodingStandard.ControlStructures.UselessTernaryOperator" />
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch" />
<rule ref="SlevomatCodingStandard.Exceptions.DisallowNonCapturingCatch" />
<rule ref="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly" />
<rule ref="SlevomatCodingStandard.Functions.StaticClosure" />
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure" />
<rule ref="SlevomatCodingStandard.Functions.UselessParameterDefaultValue" />
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses">
<properties>
<property name="caseSensitive" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse" />
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses" />
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash" />
<rule ref="SlevomatCodingStandard.Namespaces.UseFromSameNamespace" />
<rule ref="SlevomatCodingStandard.PHP.DisallowDirectMagicInvokeCall" />
<rule ref="SlevomatCodingStandard.PHP.OptimizedFunctionsWithoutUnpacking" />
<rule ref="SlevomatCodingStandard.PHP.ShortList" />
<rule ref="SlevomatCodingStandard.PHP.TypeCast" />
<rule ref="SlevomatCodingStandard.PHP.UselessParentheses" />
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon" />
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" />
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" />
<rule ref="SlevomatCodingStandard.TypeHints.NullTypeHintOnLastPosition" />
<rule ref="SlevomatCodingStandard.Variables.DisallowVariableVariable" />
<rule ref="SlevomatCodingStandard.Variables.DuplicateAssignmentToVariable" />
<rule ref="SlevomatCodingStandard.Variables.UnusedVariable">
<properties>
<property name="ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach" value="true" />
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Variables.UselessVariable" />
<!--
Ignore Rules for Tests
-->
<rule ref="PluginCheck.CodeAnalysis.Offloading.OffloadedContent">
<exclude-pattern>/tests/*</exclude-pattern>
</rule>
<!-- Do not apply filename rules for unit tests -->
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<!-- Plugin-specific rule configs -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<exclude-pattern>includes/abilities-api.php</exclude-pattern>
<exclude-pattern>includes/abilities-api/*</exclude-pattern>
<properties>
<property name="prefixes" type="array">
<element value="WP_Abilities_Assets_Init" /><!-- Asset loader -->
<element value="WP_REST_Abilities" />
<element value="WP_ABILITIES_API" /><!-- Constant -->
</property>
</properties>
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<!-- If flagged, remove the text-domain entirely. -->
<element value="" />
</property>
</properties>
</rule>
</ruleset>