-
Notifications
You must be signed in to change notification settings - Fork 1
/
phpcs.xml
120 lines (98 loc) · 3.84 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
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>PHP_CodeSniffer configuration</description>
<config
name="installed_paths"
value="../../slevomat/coding-standard,../../wp-coding-standards/wpcs,../../phpcsstandards/phpcsutils,../../phpcsstandards/phpcsextra,../../phpcompatibility/php-compatibility/"
/>
<arg name="extensions" value="php,js,css"/>
<rule ref="PHPCompatibility">
</rule>
<config name="testVersion" value="8.2-"/>
<!-- Use WordPress as the basis of our ruleset -->
<rule ref="WordPress">
<!--
Absolutely ignoring that slow queries may occur when looking things up
by meta.
-->
<exclude name="WordPress.DB.SlowDBQuery" />
<!--
We are not limited by WordPress' naming constraints and are using PSR-4
autoloading, so we'll use that file naming convention.
-->
<exclude name="WordPress.Files.FileName" />
<!--
As there is only a single class and a single namepsace in each file,
we'll skip the file comment rule as it is sufficient to document that
single class.
-->
<exclude name="Squiz.Commenting.FileComment.Missing" />
<!--
Disable file comment checks as the only file comment is the one in the
root file, used for WordPress specific metadata.
-->
<exclude name="Squiz.Commenting.FileComment" />
<!--
Disables a check for JS being loaded from the footer. It is a silly idea
and heresy.
-->
<exclude name="WordPress.WP.EnqueuedResourceParameters.NotInFooter" />
<!--
Disable checks for class property types being dockblocked when it's
sufficient to declare their type.
-->
<exclude name="Squiz.Commenting.VariableComment.MissingVar"></exclude>
<!--
Disabling the check for the "use of" object properties that are not in
snake case as we are using code and data from 3rd parties.
-->
<exclude name="WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase"></exclude>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"></exclude>
<exclude-pattern>./tests/**</exclude-pattern>
</rule>
<!--
Disable multiline function call checks for JS files.
This sniff seems to be buggy as it is insisiting on spaces, instead of tabs.
-->
<rule ref="PEAR.Functions.FunctionCallSignature.Indent">
<exclude-pattern>./js/**</exclude-pattern>
</rule>
<!--
Excluding commenting rules from tests, as we are using TestDox instead
-->
<rule ref="Squiz.Commenting.ClassComment.Missing">
<exclude-pattern>./tests/**</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.Missing">
<exclude-pattern>./tests/**</exclude-pattern>
</rule>
<!-- Disable everything from the phpcsextra package -->
<rule ref="Universal">
<exclude name="Universal"></exclude>
</rule>
<!-- Enforce strict type decleration at top of all PHP files -->
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
<properties>
<property name="spacesCountAroundEqualsSign" value="1" />
<property name="linesCountBeforeDeclare" value="1" />
<property name="linesCountAfterDeclare" value="1" />
</properties>
</rule>
<!-- Enforce type hinting for function parameters -->
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- Enforce type hinting for function return values -->
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint">
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification" />
</rule>
<!-- Disallow "sloppy" equals operators -->
<rule ref="SlevomatCodingStandard.Operators.DisallowEqualOperators">
</rule>
<rule ref="SlevomatCodingStandard.Namespaces.UnusedUses"></rule>
<rule ref="Generic.ControlStructures.DisallowYodaConditions"></rule>
<!--
Exclude the vendor direcotry because of course
-->
<exclude-pattern>./vendor/*</exclude-pattern>
</ruleset>