forked from eason9487/grow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml.dist
112 lines (96 loc) · 4.12 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
<?xml version="1.0"?>
<ruleset name="WordPress Coding Standards for Plugins">
<description>Generally-applicable sniffs for WordPress plugins</description>
<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="PSR12.Files.FileHeader.IncorrectOrder"/>
<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 do direct DB queries for our custom tables, and we have custom caching. -->
<exclude name="WordPress.DB.DirectDatabaseQuery.DirectQuery"/>
<exclude name="WordPress.DB.DirectDatabaseQuery.NoCaching"/>
<!-- We like short array syntax -->
<exclude name="Universal.Arrays.DisallowShortArraySyntax"/>
<!-- Multiple throws tags are fine -->
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.WrongNumber"/>
</rule>
<!-- Include some other sniffs we want to enforce. -->
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
<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"/>
</rule>
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!-- 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>
<!-- CLI tools -->
<rule ref="WordPress.Security.EscapeOutput">
<exclude-pattern>./packages/github-actions/actions/hook-documentation/bin/*</exclude-pattern>
<exclude-pattern>./packages/github-actions/actions/hook-documentation/src/Documentor.php</exclude-pattern>
<exclude-pattern>./packages/php/woorelease-extension/*</exclude-pattern>
</rule>
<!-- These comments are unnecessary in tests -->
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.ClassComment.Missing">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.VariableComment.Missing">
<exclude-pattern>*/tests/*</exclude-pattern>
</rule>
<!-- Check PHP files -->
<arg name="extensions" value="php"/>
<file>./plugins</file>
<file>./packages/php</file>
<file>./packages/github-actions/actions</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>
</ruleset>