-
Notifications
You must be signed in to change notification settings - Fork 4
/
phpcs.xml
153 lines (125 loc) · 6.34 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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="Pressidium-Default"
xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>A base ruleset that all other Pressidium rulesets should extend.</description>
<!-- Exclude some languages and tests -->
<exclude-pattern>*/phpunit.xml*</exclude-pattern>
<exclude-pattern>*/theme/languages/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/cypress/integration/*</exclude-pattern>
<!-- Exclude third-party code -->
<exclude-pattern>*/theme.bower-components/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Set installed paths for the standards we're using -->
<config name="installed_paths" value="vendor/wp-coding-standards/wpcs,vendor/phpcompatibility/php-compatibility,vendor/phpcompatibility/phpcompatibility-wp,vendor/phpcompatibility/phpcompatibility-paragonie" />
<!-- Scan only PHP files in this directory and its subdirectories -->
<file>.</file>
<arg name="extensions" value="php" />
<!-- Whenever possible, cache the scan results and re-use those for unchanged files on the next scan -->
<arg name="cache" />
<!-- Strip the file paths down to the relevant bit -->
<arg name="basepath" value="./" />
<!-- Show results with colors -->
<arg name="colors" />
<!-- Parallel processing for faster results, check up to 8 files simultaneously -->
<arg name="parallel" value="8" />
<!-- Show sniff codes in all reports -->
<arg value="ps" />
<!-- Set the minimum supported WordPress version -->
<config name="minimum_supported_wp_version" value="6.0" />
<!-- Don't worry about files that don't contain any code -->
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
<!-- Use the WordPress Doc Standards as a basis -->
<rule ref="WordPress-Docs">
<!--
... If files, variables, functions or methods are given descriptive names like they should be,
... then an explicit description is often unnecessary, so leave this as a judgement call
-->
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
<exclude name="Squiz.Commenting.FileComment.Missing" />
<exclude name="Squiz.Commenting.ClassComment.Missing" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Squiz.Commenting.VariableComment.Missing" />
<exclude name="Squiz.Commenting.VariableComment.MissingVar" />
<!-- Do not require a @package tag -->
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
<!--
... Class comments are generally not useful, so they're left out,
... but then PHPCS confuses the plugin headers for a class comment
-->
<exclude name="Squiz.Commenting.ClassComment.WrongStyle" />
<exclude name="Squiz.Commenting.ClassComment.SpacingAfter" />
</rule>
<!-- Prevent empty lines after a block comment -->
<rule ref="Squiz.Commenting.BlockComment.NoEmptyLineAfter" />
<!-- Use the WordPress Coding Standards as a basis -->
<rule ref="WordPress-Extra">
<!-- Forget about file names, comply with PSR-0 instead -->
<exclude name="WordPress.Files.FileName" />
<!-- Ignore yoda conditions, forbid "assignments in conditions" instead -->
<exclude name="WordPress.PHP.YodaConditions" />
<!-- A while loop is the only valid control structure where an assignment can be justified -->
<exclude name="WordPress.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition" />
<!--
... Warn about mis-aligned array items, but don't automatically "fix" them, because arrays in function
... calls get extra lines added.
...
... @see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1305
-->
<exclude phpcbf-only="true" name="PEAR.Functions.FunctionCallSignature" />
<!-- Indent with spaces instead of tabs, comply with PSR-2 -->
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent" />
<!-- Inline comments don't have to end in full-stops, exclamation marks or question marks -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
</rule>
<!-- Disallow real tabs, indent with 4 spaces instead -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4" />
<property name="tabIndent" value="false" />
</properties>
</rule>
<rule ref="Generic.WhiteSpace.DisallowTabIndent" />
<!-- Disallow Yoda conditions -->
<rule ref="Generic.ControlStructures.DisallowYodaConditions" />
<!-- It's often obvious what the placeholder is, so let's make it a warning instead -->
<rule ref="WordPress.WP.I18n.MissingTranslatorsComment">
<type>warning</type>
</rule>
<!--
... In multidimensional arrays, items in the child arrays should be aligned, but the parent arrays should
... not be aligned, since they are not neighboring lines.
...
... @see https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1565
-->
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="alignMultilineItems" value="!=100" />
</properties>
</rule>
<!-- Allow precision alignment for objects -->
<rule ref="WordPress.WhiteSpace.PrecisionAlignment">
<properties>
<property name="ignoreAlignmentTokens" type="array" value="T_OBJECT_OPERATOR" />
</properties>
</rule>
<!-- Set custom line length limits -->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="120" />
<property name="absoluteLineLimit" value="120" />
</properties>
</rule>
<!--
... Load the WordPress specific ruleset to check for PHP cross version compatibility
...
... @see https://github.com/PHPCompatibility/PHPCompatibilityWP
-->
<rule ref="PHPCompatibilityWP" />
<config name="testVersion" value="7.4-" />
</ruleset>