-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml.dist
115 lines (97 loc) · 4.08 KB
/
phpcs.xml.dist
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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>
<!-- Set the minimum WP version -->
<config name="minimum_supported_wp_version" value="5.8"/>
<rule ref="WordPress">
<!-- We don't require conforming to WP file naming -->
<exclude name="WordPress.Files.FileName"/>
<!-- These comments are unnecessary -->
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<exclude name="Squiz.Commenting.FileComment"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
<exclude name="Squiz.Commenting.LongConditionClosingComment"/>
<!-- No thanks -->
<exclude name="Universal.Operators.DisallowShortTernary"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<!-- These overrides are useful for code hinting -->
<exclude name="Generic.CodeAnalysis.UselessOverridingMethod.Found"/>
<!-- We like short array syntax -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
<!-- Multiple throws tags are fine -->
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.WrongNumber"/>
<!-- Disable this warning since we load Google external scripts -->
<exclude name="WordPress.WP.EnqueuedResourceParameters.MissingVersion"/>
</rule>
<!-- Include some other sniffs we want to enforce. -->
<rule ref="Generic.VersionControl.GitMergeConflict"/>
<rule ref="Generic.WhiteSpace.SpreadOperatorSpacingAfter"/>
<rule ref="PSR12.Classes.AnonClassDeclaration"/>
<rule ref="PSR12.Classes.ClassInstantiation"/>
<rule ref="PSR12.Files.ImportStatement"/>
<rule ref="PSR12.Functions.NullableTypeDeclaration"/>
<rule ref="PSR12.Functions.ReturnTypeDeclaration"/>
<rule ref="PSR12.Properties.ConstantVisibility"/>
<rule ref="PSR12.Traits.UseDeclaration"/>
<rule ref="Squiz.Classes">
<exclude name="Squiz.Classes.ClassDeclaration.OpenBraceNewLine"/>
<exclude name="Squiz.Classes.ClassDeclaration.CloseBraceSameLine"/>
<exclude name="Squiz.Classes.ClassDeclaration.SpaceBeforeKeyword"/>
<exclude name="Squiz.Classes.ClassDeclaration.SpaceBeforeCloseBrace"/>
<exclude name="Squiz.Classes.ClassFileName.NoMatch"/>
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
</rule>
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!-- Set the appropriate text domain. -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array" value="woocommerce-google-analytics-integration"/>
</properties>
</rule>
<!-- Add manage_woocommerce to accepted user capabilities -->
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="manage_woocommerce"/>
</property>
</properties>
</rule>
<!-- This rule flags space indents in HTML tags, which are generally OK. -->
<rule ref="Universal.WhiteSpace.PrecisionAlignment">
<exclude name="Universal.WhiteSpace.PrecisionAlignment.Found"/>
</rule>
<!-- We allow the use of / in hooks -->
<rule ref="WordPress.NamingConventions.ValidHookName">
<properties>
<property name="additionalWordDelimiters" value="/"/>
</properties>
</rule>
<!-- We don't use these functions for purposes of obfuscation -->
<rule ref="WordPress.PHP.DiscouragedPHPFunctions">
<properties>
<property name="exclude" type="array">
<element value="obfuscation"/>
</property>
</properties>
</rule>
<!-- We'd rather use native functions -->
<rule ref="WordPress.WP.AlternativeFunctions">
<properties>
<property name="exclude" type="array">
<element value="json_encode"/>
<element value="rand"/>
</property>
</properties>
</rule>
<!-- Check PHP files -->
<arg name="extensions" value="php"/>
<file>.</file>
<!-- Show progress and sniff codes in all reports -->
<arg value="ps"/>
<!-- Exclusion patterns -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>./assets/*</exclude-pattern>
</ruleset>