-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphpcs.xml
182 lines (151 loc) · 6.98 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?xml version="1.0"?>
<ruleset name="WordPress WooCommerce Coding Standards" lwdt="202402162022">
<description>PHP_CodeSniffer version 3.8.0 (stable) by Squiz and PHPCSStandards</description>
<!-- Exclude paths -->
<exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Configs -->
<config name="minimum_wp_version" value="6.0"/>
<config name="minimum_supported_wp_version" value="6.5" />
<!-- Check code for cross-version PHP compatibility. -->
<config name="testVersion" value="7.4-"/>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="wk-uvdesk"/>
</property>
</properties>
</rule>
<!-- Only check PHP files. -->
<arg name="extensions" value="php"/>
<!-- Show progress, show the error codes for each message (source). -->
<arg value="ps"/>
<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>
<rule ref="WordPress">
<!-- This project needs to comply with naming standards from PHPCS, not WP. -->
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
<!-- While conditions with assignments are a typical way to walk the token stream. -->
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>
</rule>
<rule ref="WordPress.DB.PreparedSQL"/>
<rule ref="WordPress.DB.PreparedSQLPlaceholders"/>
<!--
#############################################################################
SNIFF SPECIFIC CONFIGURATION
#############################################################################
-->
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="alignMultilineItems" value="!=100"/>
<property name="exact" value="false" phpcs-only="true"/>
</properties>
</rule>
<rule ref="WordPress.Arrays.ArrayIndentation"/>
<!-- WordPress Rules -->
<rule ref="WordPress-Core"/>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress-Extra">
<exclude name="WordPress.WP.TimezoneChange.timezone_change_date_default_timezone_set"/>
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
</rule>
<rule ref="WordPressVIPMinimum">
<exclude name="WordPressVIPMinimum.Files.IncludingFile.UsingCustomConstant"/>
<exclude name="WordPressVIPMinimum.Files.IncludingFile.UsingVariable"/>
<exclude name="WordPressVIPMinimum.Functions.RestrictedFunctions"/>
</rule>
<rule ref="WordPress-VIP-Go"/>
<rule ref="WordPress.WP.I18n"/>
<!-- WooCommerce Rules -->
<rule ref="WooCommerce">
<exclude name="WooCommerce.Commenting.CommentHooks.MissingHookComment"/>
</rule>
<rule ref="WooCommerce-Core"/>
<!-- Covers rule: Use single and double quotes when appropriate.
If you're not evaluating anything in the string, use single quotes. -->
<rule ref="Squiz.Strings.DoubleQuoteUsage.NotRequired"/>
<!--
#############################################################################
Handbook: PHP - Indentation.
Ref: https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/#indentation
#############################################################################-->
<!-- Covers rule: Your indentation should always reflect logical structure. -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="exact" value="false"/>
<property name="indent" value="4"/>
<property name="tabIndent" value="true"/>
<property name="ignoreIndentationTokens" type="array">
<element value="T_HEREDOC"/>
<element value="T_NOWDOC"/>
<element value="T_INLINE_HTML"/>
</property>
</properties>
</rule>
<!-- PHPCompatibility Rules. -->
<rule ref="PHPCompatibility">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<!--Exclude WooCommerce sanitization function -->
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<properties>
<property name="customSanitizingFunctions" type="array">
<element value="wc_clean"/>
</property>
</properties>
</rule>
<!-- WordPress theme files and directories must be named using lowercase letters. Words must be separated by hyphens, not camelCase or underscores. -->
<rule ref="WordPress.Files.FileName"/>
<!-- Validate, sanitize, and escape everything. -->
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="wk_marketplace_seller"/>
</property>
</properties>
</rule>
<!-- The eval() function must not be used. -->
<rule ref="Squiz.PHP.Eval.Discouraged">
<type>error</type>
<message>eval() is a security risk so not allowed.</message>
</rule>
<!-- Single-statement inline control structures are prohibited. Either curly braces should be used (even where they are optional) or where appropriate the alternative syntax for control structures may be used. -->
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!-- A unique prefix must be used for all function names, classes, hooks, public/global variables, action/filter hooks, custom image sizes, constants, database entries, theme-specific scripts and theme-specific styles to avoid conflicts with plugins and other themes. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals"/>
<!-- Rule: The goto statement must never be used. -->
<rule ref="Generic.PHP.DiscourageGoto">
<type>error</type>
<message>The "goto" language construct should not be used.</message>
</rule>
<!-- A few rules not mentioned in the official documentation. -->
<rule ref="Generic.Files.ByteOrderMark"/>
<!-- Tabs must be used for indentation. -->
<arg name="tab-width" value="4"/>
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<!-- The use of PHP short tags is not allowed. -->
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<rule ref="Generic.PHP.DisallowAlternativePHPTags"/>
<!-- The create_function() function has been deprecated as of PHP 7.2.0 and must no longer be used. -->
<rule ref="WordPress.PHP.RestrictedPHPFunctions"/>
<!-- The "@" operator must not be used to suppress error messages or notices. -->
<rule ref="WordPress.PHP.NoSilencedErrors"/>
<!-- Using the POSIX Regex functions ereg_* aren’t allowed. -->
<rule ref="WordPress.PHP.POSIXFunctions"/>
<rule ref="VariableAnalysis"/>
<rule ref="PSR12">
<exclude name="Generic.WhiteSpace.DisallowTabIndent"/>
<exclude name="PSR12.Operators.OperatorSpacing"/>
<exclude name="Generic.Files.LineLength.TooLong"/>
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
<exclude name="PSR1.Files.SideEffects.FoundWithSymbols"/>
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps"/>
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceAfterOpenBracket"/>
<exclude name="PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket"/>
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpaceBeforeCloseBrace"/>
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace"/>
</rule>
</ruleset>