-
Notifications
You must be signed in to change notification settings - Fork 8
/
phpcs.xml
158 lines (135 loc) · 5.34 KB
/
phpcs.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
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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Accessibility Checker">
<description>Accessibility Checker WordPress Coding Standards</description>
<!-- Scan all files in directory -->
<file>.</file>
<!-- Folders to exclude -->
<exclude-pattern>./dist/</exclude-pattern>
<exclude-pattern>./vendor/</exclude-pattern>
<exclude-pattern>./node_modules/</exclude-pattern>
<exclude-pattern>./.wp-env/</exclude-pattern>
<exclude-pattern>./simple_html_dom.php</exclude-pattern>
<exclude-pattern>./update-composer-config.php</exclude-pattern>
<!-- Scan only PHP files -->
<arg name="extensions" value="php"/>
<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Show progress, show the error codes for each message (source). -->
<arg value="sp"/>
<!-- Include the WordPress-Extra standard. -->
<rule ref="WordPress-Extra" />
<!-- Let's also check that everything is properly documented. -->
<rule ref="WordPress-Docs"/>
<!-- Add in some extra rules from other standards. -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Commenting.Todo"/>
<!-- Add the WordPress-VIP-Go standard -->
<rule ref="WordPress-VIP-Go"/>
<!-- Run against the PHPCompatibility ruleset -->
<rule ref="PHPCompatibility">
<!-- WP supports down to 7.0 : https://wordpress.org/about/requirements/ -->
<config name="testVersion" value="7.0-"/>
</rule>
<config name="minimum_wp_version" value="6.2"/>
<rule ref="WordPress-Core"/>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="accessibility-checker"/>
</property>
</properties>
</rule>
<!-- Run against the PHPCompatibility ruleset -->
<rule ref="PHPCompatibility">
<!-- WP supports down to 7.0 : https://wordpress.org/about/requirements/ -->
<config name="testVersion" value="7.0-"/>
</rule>
<!-- The %i placeholder is supported in WP since v6.2. -->
<rule ref="WordPress.DB.PreparedSQLPlaceholders.UnsupportedIdentifierPlaceholder">
<severity>1</severity>
</rule>
<!-- Thw WP VIP ruleset disables some of the default rules, so we re-enable them
as they may not be "required", but are still good practices. -->
<rule ref="Internal.LineEndings.Mixed">
<severity>6</severity>
</rule>
<rule ref="Generic.CodeAnalysis.AssignmentInCondition">
<severity>6</severity>
</rule>
<rule ref="WordPress.CodeAnalysis.AssignmentInTernaryCondition.FoundInTernaryCondition">
<severity>6</severity>
</rule>
<rule ref="WordPress.PHP.DiscouragedPHPFunctions.urlencode_urlencode">
<severity>6</severity>
</rule>
<rule ref="WordPress.PHP.DontExtract">
<severity>6</severity>
</rule>
<rule ref="Universal.Operators.StrictComparisons">
<severity>6</severity>
</rule>
<rule ref="WordPress.PHP.StrictInArray.MissingTrueStrict">
<severity>6</severity>
</rule>
<rule ref="WordPress.Security.EscapeOutput.UnsafePrintingFunction">
<!-- We trust that translations are safe on VIP Go -->
<severity>6</severity>
</rule>
<rule ref="Generic.PHP.NoSilencedErrors">
<severity>6</severity>
</rule>
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable">
<severity>5</severity>
</rule>
<rule ref="WordPress.DB.SlowDBQuery.slow_db_query_meta_key">
<severity>6</severity>
</rule>
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound">
<severity>6</severity>
</rule>
<rule ref="WordPress.WP.AlternativeFunctions.file_system_operations_readfile">
<severity>4</severity>
</rule>
<rule ref="WordPress.WP.AlternativeFunctions.file_system_operations_fclose">
<severity>4</severity>
</rule>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines"/>
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine"/>
<rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis">
<properties>
<!-- Do not report on unused variables before require nor usused or undefined variables in file scope. -->
<property name="allowUnusedVariablesBeforeRequire" value="false"/>
<property name="allowUndefinedVariablesInFileScope" value="false"/>
</properties>
</rule>
<!-- End of VIP resets -->
<config name="minimum_supported_wp_version" value="6.2.0"/>
<!--
Prevent errors caused by WordPress Coding Standards not supporting PHP 8.0+.
See: https://github.com/WordPress/WordPress-Coding-Standards/issues/2035#issuecomment-1289516545
-->
<ini name="error_reporting" value="E_ALL & ~E_DEPRECATED" />
<!-- Exclude these rules from the tests directory only -->
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="PSR2.Namespaces.NamespaceDeclaration.BlankLineAfter">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<!-- Allow and enforce shorthand arrays -->
<rule ref="WordPress">
<exclude name="Generic.Arrays.DisallowShortArraySyntax"/>
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
</rule>
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<!-- Exclude rules that block PSR-4 compliance -->
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/>
</rule>
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude name="WordPress.Files.FileName.InvalidClassFileName"/>
</rule>
</ruleset>