-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathphpcs.xml.dist
113 lines (94 loc) · 5.22 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WordPress Coding Standards" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd">
<description>The Coding standard for the WordPress Coding Standards itself.</description>
<!--
#############################################################################
COMMAND LINE ARGUMENTS
https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki/Annotated-Ruleset
#############################################################################
-->
<file>.</file>
<!-- Exclude Composer vendor directory. -->
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- Only check PHP files. -->
<arg name="extensions" value="php"/>
<!-- Show progress, show the error codes for each message (source). -->
<arg value="ps"/>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="."/>
<!-- Check up to 8 files simultaneously. -->
<arg name="parallel" value="8"/>
<arg name="tab-width" value="0"/> <!-- Prevents PHPCS from enforcing tab width -->
<!-- Exclude specific rule that enforces tabs -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="ignoreIndentationTokens" type="array">
<element value="T_COMMENT"/>
<element value="T_DOC_COMMENT_OPEN_TAG"/>
</property>
</properties>
</rule>
<!-- Disable tab enforcement -->
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>
<rule ref="WordPress">
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/> <!-- Fully exclude tab enforcement -->
</rule>
<!--
#############################################################################
SET UP THE RULESETS
#############################################################################
-->
<rule ref="WordPress">
<!-- This project needs to comply with naming standards from PHPCS, not WP. -->
<exclude name="WordPress.Files.FileName"/>
<exclude name="WordPress.NamingConventions.ValidVariableName"/>
<!-- While conditions with assignments are a typical way to walk the token stream. -->
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.FoundInWhileCondition"/>
<!-- The code in this project is run in the context of PHPCS, not WP. -->
<exclude name="WordPress.DateTime"/>
<exclude name="WordPress.DB"/>
<exclude name="WordPress.Security"/>
<exclude name="WordPress.WP"/>
<!-- Linting is done in a separate CI job, no need to duplicate it. -->
<exclude name="Generic.PHP.Syntax"/>
</rule>
<!--
#############################################################################
SNIFF SPECIFIC CONFIGURATION
#############################################################################
-->
<rule ref="WordPress.Arrays.MultipleStatementAlignment">
<properties>
<property name="alignMultilineItems" value="!=100"/>
<property name="exact" value="false" phpcs-only="true"/>
</properties>
</rule>
<rule ref="WordPress">
<!-- Disable inline comment ending enforcement -->
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
<!-- Disable requirement for a short description in doc comments -->
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
<!-- Disable snake_case requirement for method names -->
<exclude name="WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid"/>
<!-- Disable enforcement of full stops at the end of parameter comments -->
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop"/>
<exclude name="Squiz.Commenting.FunctionComment.EmptyThrows"/>
<exclude name="WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/>
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis"/>
<exclude name="Generic.Commenting.DocComment.ShortNotCapital"/>
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment"/>
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceAfterOpen"/>
<exclude name="Generic.CodeAnalysis.AssignmentInCondition.Found"/>
<exclude name="Squiz.PHP.DisallowMultipleAssignments.FoundInControlStructure"/>
<exclude name="Generic.WhiteSpace.ArbitraryParenthesesSpacing.SpaceBeforeClose"/>
<exclude name="WordPress.PHP.DontExtract.extract_extract"/>
<exclude name="Squiz.Commenting.FileComment.Missing"/>
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedCatch"/>
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
</rule>
</ruleset>