-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
102 lines (80 loc) · 4.14 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
<?xml version="1.0"?>
<ruleset name="Coding standards">
<description>Wordpress Coding Standards</description>
<!-- Scan all files in directory -->
<file>.</file>
<!-- Scan only PHP files -->
<arg name="extensions" value="php" />
<!-- Show colors in console -->
<arg value="-colors" />
<!-- Show sniff codes in all reports -->
<arg value="ns" />
<!-- Run against the PHPCompatibility ruleset -->
<rule ref="PHPCompatibility" />
<!-- Run against the Doctrine ruleset -->
<rule ref="Doctrine">
<exclude name="Generic.WhiteSpace.DisallowTabIndent.TabsUsed" />
</rule>
<!-- Include the WordPress-Extra standard. -->
<rule ref="WordPress-Extra">
<!-- Exclude any rules here -->
<exclude name="Generic.Files.LineEndings.InvalidEOLChar" />
<exclude name="Generic.Files.EndFileNewline.NotFound" />
<exclude name="WordPress.PHP.DisallowShortTernary" />
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoComma" />
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
<exclude name="PEAR.NamingConventions.ValidFunctionName.FunctionNoCapital" />
<exclude name="Squiz.Commenting.VariableComment.Missing" />
<exclude name="PSR2.Files.ClosingTag.NotAllowed" />
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="Squiz.Commenting.FileComment.Missing" />
</rule>
<!-- Let's also check that everything is properly documented. -->
<rule ref="WordPress-Docs" />
<!-- PHP code MUST use only UTF-8 without BOM. -->
<rule ref="Generic.Files.ByteOrderMark" />
<!-- Class names MUST be declared in StudlyCaps. -->
<rule ref="Squiz.Classes.ValidClassName" />
<!-- Class constants MUST be declared in all upper case with underscore separators. -->
<rule ref="Generic.NamingConventions.UpperCaseConstantName" />
<!-- There MUST NOT be trailing whitespace at the end of non-blank lines. -->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace" />
<!-- Method names MUST NOT be declared with a space after the method name. The opening brace
MUST go on its own line, and the closing brace MUST go on the next line following the body.
There MUST NOT be a space after the opening parenthesis, and there MUST NOT be a space before
the closing parenthesis. -->
<rule ref="Squiz.Functions.FunctionDeclaration" />
<rule ref="Squiz.Functions.LowercaseFunctionKeywords" />
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.SpacingAfterHint">
<severity>0</severity>
</rule>
<!-- When making a method or function call, there MUST NOT be a space between the method or
function name and the opening parenthesis, there MUST NOT be a space after the opening
parenthesis, and there MUST NOT be a space before the closing parenthesis. In the argument list,
there MUST NOT be a space before each comma, and there MUST be one space after each comma.
Argument lists MAY be split across multiple lines, where each subsequent line is indented once.
When doing so, the first item in the list MUST be on the next line, and there MUST be only one
argument per line. -->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing" />
<rule ref="PSR2.Methods.FunctionCallSignature.SpaceAfterCloseBracket">
<severity>0</severity>
</rule>
<!-- The body of each structure MUST be enclosed by braces. This standardizes how the structures
look, and reduces the likelihood of introducing errors as new lines get added to the body. -->
<rule ref="Generic.ControlStructures.InlineControlStructure" />
<!-- In the argument list, there MUST NOT be a space before each comma, and there MUST be one
space after each comma. -->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1" />
<property name="requiredSpacesAfterOpen" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
<!-- Add in some extra rules from other standards. -->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter" />
<rule ref="Generic.Commenting.Todo" />
<config name="minimum_supported_wp_version" value="4.9" />
</ruleset>