-
Notifications
You must be signed in to change notification settings - Fork 3
/
phpcs.xml
170 lines (146 loc) · 6.87 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
<?xml version="1.0"?>
<ruleset name="remote-data-blocks">
<description>Custom ruleset for Remote Data Blocks</description>
<!-- For help in understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml -->
<!-- For help in using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage -->
<!-- What to scan -->
<file>.</file>
<!-- Ignoring Files and Folders:
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders -->
<!-- Submodules - these should have their own PHPCS configurations -->
<!-- Other directories -->
<exclude-pattern>\.git/*</exclude-pattern>
<exclude-pattern>/build/*</exclude-pattern>
<exclude-pattern>/node_modules/*</exclude-pattern>
<exclude-pattern>/vendor/*</exclude-pattern>
<!-- How to scan -->
<!-- Strip the file paths down to the relevant bit -->
<arg name="basepath" value="."/>
<!-- Enables parallel processing when available for faster results. -->
<arg name="parallel" value="8"/>
<!-- Limit to PHP files -->
<arg name="extensions" value="php"/>
<arg value="s"/>
<!-- Rules: Check PHP version compatibility - see
https://github.com/PHPCompatibility/PHPCompatibilityWP -->
<rule ref="PHPCompatibilityWP"/>
<!-- For help in understanding this testVersion:
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
<config name="testVersion" value="8.1-"/>
<!-- Rules: WordPress Coding Standards - see
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards -->
<!-- WordPress-Extra includes WordPress-Core -->
<rule ref="WordPress-Extra"/>
<!-- For help in understanding these custom sniff properties:
https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties -->
<config name="minimum_supported_wp_version" value="6.6"/>
<!-- Rules: Check VIP Coding Standards - see
https://github.com/Automattic/VIP-Coding-Standards/ -->
<rule ref="WordPress-VIP-Go">
<!-- These disallow anonymous functions as action callbacks -->
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket" />
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments" />
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine" />
<!-- Allow short array syntax -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" />
<!-- Do not enforce 'class-' prefix -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<!-- Allow short ternaries -->
<exclude name="Universal.Operators.DisallowShortTernary.Found" />
<!-- Generates too many false positives -->
<exclude name="WordPress.WP.CapitalPDangit.Misspelled" />
<!-- We use trigger_error extensively -->
<exclude name="WordPress.PHP.DevelopmentFunctions.error_log_trigger_error" />
<exclude name="Universal.NamingConventions.NoReservedKeywordParameterNames" />
<!--
Coordinates with Squiz.WhiteSpace.OperatorSpacing | ignoreSpacingBeforeAssignments=false
We don't want to enforce all subsequent assignments to have the same spacing before the assignment operator.
Doing so means a single change to one line can result in a large changeset that's more difficult to review.
-->
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning" />
<exclude name="WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned" />
<exclude name="WordPress.WhiteSpace.OperatorSpacing" />
</rule>
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<!-- Standardize on a single space after assignments -->
<property name="ignoreSpacingBeforeAssignments" value="false" />
</properties>
</rule>
<!-- Relax a few rules for tests and example code -->
<rule ref="Generic.Files.OneObjectStructurePerFile.MultipleFound">
<exclude-pattern>/example/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
</rule>
<rule ref="Universal.Files.SeparateFunctionsFromOO.Mixed">
<exclude-pattern>/example/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.Files.FileName.NotHyphenatedLowercase">
<exclude-pattern>/inc/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
</rule>
<!-- Exclude PSR12.Files.FileHeader.IncorrectOrder for specific files -->
<rule ref="PSR12.Files.FileHeader.IncorrectOrder">
<exclude-pattern>remote-data-blocks.php</exclude-pattern>
<exclude-pattern>functions.php</exclude-pattern>
<exclude-pattern>example/remote-data-blocks-example-code.php</exclude-pattern>
</rule>
<!-- These functions are new via the Interactivity API and are auto-escaped -->
<rule ref="WordPress.Security.EscapeOutput">
<properties>
<property name="customAutoEscapedFunctions" type="array">
<element value="get_block_wrapper_attributes" />
<element value="wp_interactivity_data_wp_context" />
</property>
</properties>
</rule>
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="view_query_monitor" />
</property>
</properties>
</rule>
<!-- Slevomat Coding Standard -->
<rule ref="SlevomatCodingStandard.Commenting.AnnotationName"/>
<rule ref="SlevomatCodingStandard.Commenting.ForbiddenAnnotations">
<properties>
<property name="forbiddenAnnotations" type="array">
<element value="@author"/>
<element value="@since"/>
<element value="@package"/>
</property>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.Commenting.UselessFunctionDocComment"/>
<rule ref="SlevomatCodingStandard.Commenting.UselessInheritDocComment"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses">
<properties>
<property name="searchAnnotations" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="declareOnFirstLine" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/>
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude-pattern>/example/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/inc/REST/DataSourceController.php</exclude-pattern>
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude-pattern>/example/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude-pattern>/example/*</exclude-pattern>
<exclude-pattern>/tests/*</exclude-pattern>
<exclude-pattern>/inc/REST/DataSourceController.php</exclude-pattern>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
</ruleset>