|
1 | 1 | <?xml version="1.0"?> |
2 | 2 | <ruleset name="WordPress Coding Standards based custom ruleset for your plugin"> |
3 | | - <description>Generally-applicable sniffs for WordPress plugins.</description> |
4 | | - |
5 | | - <!-- What to scan --> |
6 | | - <file>.</file> |
7 | | - <exclude-pattern>/vendor/</exclude-pattern> |
8 | | - <exclude-pattern>/node_modules/</exclude-pattern> |
9 | | - |
10 | | - <!-- How to scan --> |
11 | | - <!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> |
12 | | - <!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> |
13 | | - <arg value="sp"/> <!-- Show sniff and progress --> |
14 | | - <arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit --> |
15 | | - <arg name="colors"/> |
16 | | - <arg name="extensions" value="php"/> |
17 | | - <arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. --> |
18 | | - |
19 | | - <!-- Rules: WordPress Coding Standards --> |
20 | | - <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> |
21 | | - <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties --> |
22 | | - <config name="minimum_supported_wp_version" value="5.5"/> |
23 | | - <rule ref="WordPress"> |
24 | | - |
25 | | - </rule> |
26 | | - |
27 | | - <rule ref="Squiz.Commenting.FileComment.Missing"> |
28 | | - <exclude-pattern>tests</exclude-pattern> |
29 | | - <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
30 | | - </rule> |
31 | | - |
32 | | - <rule ref="Squiz.Commenting.FunctionComment"> |
33 | | - <exclude-pattern>tests</exclude-pattern> |
34 | | - </rule> |
35 | | - |
36 | | - <rule ref="PSR12.Files.FileHeader.IncorrectOrder"> |
37 | | - <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
| 3 | + <description>Generally-applicable sniffs for WordPress plugins.</description> |
| 4 | + |
| 5 | + <!-- What to scan --> |
| 6 | + <file>.</file> |
| 7 | + <exclude-pattern>/vendor/</exclude-pattern> |
| 8 | + <exclude-pattern>/node_modules/</exclude-pattern> |
| 9 | + |
| 10 | + <!-- How to scan --> |
| 11 | + <!-- Usage instructions: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage --> |
| 12 | + <!-- Annotated ruleset: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml --> |
| 13 | + <arg value="sp"/> <!-- Show sniff and progress --> |
| 14 | + <arg name="basepath" value="./"/><!-- Strip the file paths down to the relevant bit --> |
| 15 | + <arg name="colors"/> |
| 16 | + <arg name="extensions" value="php"/> |
| 17 | + <arg name="parallel" value="8"/><!-- Enables parallel processing when available for faster results. --> |
| 18 | + |
| 19 | + <!-- Rules: WordPress Coding Standards --> |
| 20 | + <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards --> |
| 21 | + <!-- https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties --> |
| 22 | + <config name="minimum_supported_wp_version" value="5.5"/> |
| 23 | + <rule ref="WordPress"> |
| 24 | + |
| 25 | + </rule> |
| 26 | + |
| 27 | + <rule ref="Squiz.Commenting.FileComment.Missing"> |
| 28 | + <exclude-pattern>tests</exclude-pattern> |
| 29 | + <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
| 30 | + </rule> |
| 31 | + |
| 32 | + <rule ref="Squiz.Commenting.FunctionComment"> |
| 33 | + <exclude-pattern>tests</exclude-pattern> |
| 34 | + </rule> |
| 35 | + |
| 36 | + <rule ref="PSR12.Files.FileHeader.IncorrectOrder"> |
| 37 | + <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
| 38 | + </rule> |
| 39 | + |
| 40 | + <rule ref="WordPress-Core"> |
| 41 | + <exclude name="Generic.Arrays.DisallowShortArraySyntax"/> |
| 42 | + <exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/> |
38 | 43 | </rule> |
39 | 44 |
|
40 | | - <rule ref="WordPress-Core"> |
41 | | - <exclude name="Generic.Arrays.DisallowShortArraySyntax" /> |
42 | | - <exclude name="Universal.Arrays.DisallowShortArraySyntax.Found" /> |
43 | | - </rule> |
| 45 | + <rule ref="WordPress-Docs"> |
| 46 | + <exclude-pattern>tests/*</exclude-pattern> |
| 47 | + <exclude name="Squiz.Commenting.VariableComment.MissingVar"/> |
| 48 | + </rule> |
44 | 49 |
|
45 | | - <rule ref="WordPress-Docs"> |
46 | | - <exclude-pattern>tests/*</exclude-pattern> |
47 | | - <exclude name="Squiz.Commenting.VariableComment.MissingVar" /> |
48 | | - </rule> |
| 50 | + <rule ref="WordPress-Extra"> |
| 51 | + <exclude name="WordPress.Files.FileName"/> |
| 52 | + <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase"/> |
| 53 | + </rule> |
49 | 54 |
|
50 | | - <rule ref="WordPress-Extra"> |
51 | | - <exclude name="WordPress.Files.FileName" /> |
52 | | - <exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" /> |
53 | | - </rule> |
| 55 | + <rule ref="WordPress.Files.FileName.InvalidClassFileName"> |
| 56 | + <exclude-pattern>test</exclude-pattern> |
| 57 | + </rule> |
| 58 | + |
| 59 | + <rule ref="Generic.Commenting.DocComment"> |
| 60 | + <exclude-pattern>test</exclude-pattern> |
| 61 | + </rule> |
| 62 | + |
| 63 | + <rule ref="WordPress.WP.I18n"> |
| 64 | + <properties> |
| 65 | + <property name="text_domain" type="array"> |
| 66 | + <element value="wp-rest-blocks"/> |
| 67 | + </property> |
| 68 | + </properties> |
| 69 | + </rule> |
| 70 | + <rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> |
| 71 | + <properties> |
| 72 | + <property name="blank_line_check" value="true"/> |
| 73 | + </properties> |
| 74 | + </rule> |
| 75 | + |
| 76 | + <rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis"/> |
| 77 | + |
| 78 | + <!-- Check for cross-version support for PHP 7.4 and higher. --> |
| 79 | + <config name="testVersion" value="7.4-"/> |
| 80 | + <rule ref="PHPCompatibilityWP"/> |
| 81 | + |
| 82 | + <rule ref="Generic.Arrays.DisallowLongArraySyntax.Found"/> |
| 83 | + |
| 84 | + <!-- Checks whether the nullablity ? symbol is present before each nullable and optional parameter. --> |
| 85 | + <rule |
| 86 | + ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" |
| 87 | + /> |
| 88 | + <!-- Enforce no space between closing brace and colon of return typehint. --> |
| 89 | + <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"> |
| 90 | + <properties> |
| 91 | + <property name="spacesCountBeforeColon" value="0"/> |
| 92 | + </properties> |
| 93 | + </rule> |
| 94 | + <!-- Checks that there's no whitespace between a nullability symbol and a typehint. --> |
| 95 | + <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/> |
| 96 | + <!-- Enforces using shorthand scalar typehint variants in phpDocs. --> |
| 97 | + <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints"/> |
| 98 | + <!-- Reports useless @var annotation for constants because the type of constant is always clear. --> |
| 99 | + <rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint"/> |
| 100 | + |
| 101 | + <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"> |
| 102 | + <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
| 103 | + </rule> |
54 | 104 |
|
55 | | - <rule ref="WordPress.Files.FileName.InvalidClassFileName"> |
56 | | - <exclude-pattern>test</exclude-pattern> |
| 105 | + <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"> |
| 106 | + <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
| 107 | + <properties> |
| 108 | + <property name="enableMixedTypeHint" value="false"/> |
| 109 | + <property name="enableUnionTypeHint" value="false"/> |
| 110 | + <property name="enableIntersectionTypeHint" value="false"/> |
| 111 | + <property name="enableStandaloneNullTrueFalseTypeHints" value="false"/> |
| 112 | + </properties> |
57 | 113 | </rule> |
58 | 114 |
|
59 | | - <rule ref="Generic.Commenting.DocComment"> |
60 | | - <exclude-pattern>test</exclude-pattern> |
61 | | - </rule> |
62 | | - |
63 | | - <rule ref="WordPress.WP.I18n"> |
64 | | - <properties> |
65 | | - <property name="text_domain" type="array"> |
66 | | - <element value="wp-rest-blocks"/> |
67 | | - </property> |
68 | | - </properties> |
69 | | - </rule> |
70 | | - <rule ref="WordPress.WhiteSpace.ControlStructureSpacing"> |
71 | | - <properties> |
72 | | - <property name="blank_line_check" value="true"/> |
73 | | - </properties> |
74 | | - </rule> |
75 | | - |
76 | | - <rule ref="VariableAnalysis.CodeAnalysis.VariableAnalysis" /> |
77 | | - |
78 | | - <!-- Check for cross-version support for PHP 7.4 and higher. --> |
79 | | - <config name="testVersion" value="7.4-" /> |
80 | | - <rule ref="PHPCompatibilityWP" /> |
81 | | - |
82 | | - <rule ref="Generic.Arrays.DisallowLongArraySyntax.Found" /> |
83 | | - |
84 | | - <!-- Checks whether the nullablity ? symbol is present before each nullable and optional parameter. --> |
85 | | - <rule |
86 | | - ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue" |
87 | | - /> |
88 | | - <!-- Enforce no space between closing brace and colon of return typehint. --> |
89 | | - <rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"> |
90 | | - <properties> |
91 | | - <property name="spacesCountBeforeColon" value="0" /> |
92 | | - </properties> |
93 | | - </rule> |
94 | | - <!-- Checks that there's no whitespace between a nullability symbol and a typehint. --> |
95 | | - <rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing" /> |
96 | | - <!-- Enforces using shorthand scalar typehint variants in phpDocs. --> |
97 | | - <rule ref="SlevomatCodingStandard.TypeHints.LongTypeHints" /> |
98 | | - <!-- Reports useless @var annotation for constants because the type of constant is always clear. --> |
99 | | - <rule ref="SlevomatCodingStandard.TypeHints.UselessConstantTypeHint" /> |
100 | | - |
101 | | - <rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"> |
102 | | - <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
103 | | - </rule> |
104 | | - |
105 | | - <rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint"> |
106 | | - <exclude-pattern>wp-rest-blocks.php</exclude-pattern> |
107 | | - <properties> |
108 | | - <property name="enableMixedTypeHint" value="false" /> |
109 | | - <property name="enableUnionTypeHint" value="false" /> |
110 | | - <property name="enableIntersectionTypeHint" value="false" /> |
111 | | - <property name="enableStandaloneNullTrueFalseTypeHints" value="false" /> |
112 | | - </properties> |
113 | | - </rule> |
114 | | - |
115 | | - <rule ref="SlevomatCodingStandard.Functions.StaticClosure" /> |
| 115 | + <rule ref="SlevomatCodingStandard.Functions.StaticClosure"/> |
116 | 116 | </ruleset> |
0 commit comments