-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpcs.xml
130 lines (121 loc) · 6.68 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
<?xml version="1.0"?>
<ruleset name="WpSettingsApi">
<description>The WpSettingsApi coding standard.</description>
<!-- What to scan -->
<file>src</file>
<!-- Exclude the tests directory. -->
<exclude-pattern>*/tests/*</exclude-pattern>
<!-- Third-party code -->
<exclude-pattern>*/bower-components/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Ensure certain file types aren't sniffed -->
<exclude-pattern>*.js</exclude-pattern>
<exclude-pattern>*.css</exclude-pattern>
<!-- How to scan -->
<arg value="sp"/> <!-- Show sniff and progress -->
<arg name="basepath" value="."/><!-- Strip the file paths down to the relevant bit -->
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="tab-width" value="4"/>
<!-- For CI, don't fail on warnings -->
<config name="ignore_warnings_on_exit" value="1"/>
<!-- Sets the minimum supported WP version -->
<config name="minimum_supported_wp_version" value="6.4"/>
<!-- Check for cross-version support for PHP 8.0 and higher. -->
<config name="testVersion" value="8.0-"/>
<rule ref="WordPress-Docs">
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags"/>
<exclude name="Squiz.Commenting.FileComment.Missing"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType"/>
<exclude name="Squiz.Commenting.FunctionComment.ThrowsNoFullStop"/>
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
<exclude name="Squiz.Commenting.VariableComment.Missing"/>
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="wp-settings-api"/>
</properties>
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/>
</rule>
<!-- DISABLED UNTIL THEY SUPPORT squizlabs/php_codesniffer > 3.6.0-->
<!-- <rule ref="Inpsyde">-->
<!-- <exclude name="Generic.Metrics.NestingLevel.TooHigh"/>-->
<!-- <exclude name="Inpsyde.CodeQuality.FunctionBodyStart.WrongForMultiLineDeclaration"/>-->
<!-- <exclude name="Inpsyde.CodeQuality.LineLength.TooLong"/>-->
<!-- <exclude name="Inpsyde.CodeQuality.NoAccessors.NoGetter"/>-->
<!-- <exclude name="Inpsyde.CodeQuality.NoAccessors.NoSetter"/>-->
<!-- <exclude name="Inpsyde.CodeQuality.VariablesName.SnakeCaseVar"/>-->
<!-- <exclude name="NeutronStandard.Functions.DisallowCallUserFunc.CallUserFunc"/>-->
<!-- <exclude name="WordPress.WP.I18n.MissingTranslatorsComment"/>-->
<!-- </rule>-->
<!-- <rule ref="Inpsyde.CodeQuality.NestingLevel">-->
<!-- <properties>-->
<!-- <property name="errorLimit" value="10"/>-->
<!-- <property name="warningLimit" value="5"/>-->
<!-- </properties>-->
<!-- </rule>-->
<!-- <rule ref="Inpsyde.CodeQuality.PropertyPerClassLimit">-->
<!-- <properties>-->
<!-- <property name="maxCount" value="20"/>-->
<!-- </properties>-->
<!-- </rule>-->
<rule ref="PSR12">
<exclude name="PSR12.Classes.OpeningBraceSpace.Found"/>
<exclude name="PSR12.Files.FileHeader.IncorrectOrder"/>
<exclude name="PSR12.Files.FileHeader.SpacingAfterBlock"/>
<exclude name="PSR12.Files.OpenTag.NotAlone"/>
<exclude name="PSR12.Traits.UseDeclaration.MultipleImport"/>
<exclude name="PSR12.Traits.UseDeclaration.UseAfterBrace"/>
</rule>
<rule ref="Generic.Arrays.ArrayIndent"/>
<rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
<severity>0</severity>
</rule>
<rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
<severity>0</severity>
</rule>
<!-- Slevomat (selective) Coding Standards -->
<rule ref="SlevomatCodingStandard.Arrays.DisallowImplicitArrayCreation"/>
<rule ref="SlevomatCodingStandard.Arrays.SingleLineArrayWhitespace"/>
<rule ref="SlevomatCodingStandard.Arrays.TrailingArrayComma"/>
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
<rule ref="SlevomatCodingStandard.Classes.ModernClassNameReference"/>
<rule ref="SlevomatCodingStandard.Classes.MethodSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
<rule ref="SlevomatCodingStandard.Commenting.DeprecatedAnnotationDeclaration"/>
<rule ref="SlevomatCodingStandard.ControlStructures.AssignmentInCondition">
<properties>
<property name="ignoreAssignmentsInsideFunctionCalls" value="true"/>
</properties>
</rule>
<rule ref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison"/>
<rule ref="SlevomatCodingStandard.ControlStructures.NewWithParentheses"/>
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceEqualOperator"/>
<rule ref="SlevomatCodingStandard.ControlStructures.RequireNullCoalesceOperator"/>
<rule ref="SlevomatCodingStandard.ControlStructures.UselessIfConditionWithReturn"/>
<rule ref="SlevomatCodingStandard.Exceptions.DeadCatch"/>
<rule ref="SlevomatCodingStandard.Functions.StaticClosure"/>
<rule ref="SlevomatCodingStandard.Functions.UnusedInheritedVariablePassedToClosure"/>
<rule ref="SlevomatCodingStandard.Namespaces.AlphabeticallySortedUses"/>
<rule ref="SlevomatCodingStandard.Namespaces.DisallowGroupUse"/>
<rule ref="SlevomatCodingStandard.Namespaces.UselessAlias"/>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses.UnusedUse"/>
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators"/>
<rule ref="SlevomatCodingStandard.PHP.UselessSemicolon"/>
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.UselessAnnotation"/>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation"/>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.Variables.DisallowSuperGlobalVariable"/>
<!-- Loads the PHP Compatibility ruleset. -->
<rule ref="PHPCompatibility"/>
</ruleset>