generated from DiscipleTools/disciple-tools-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 3
/
phpcs.xml
234 lines (210 loc) · 13.4 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?xml version="1.0"?>
<ruleset name="PHP_CodeSniffer">
<description>The coding standard for disciple-tools theme</description>
<!-- This should be the same as for disciple-tools plugin -->
<!-- To check the code for style issues, run:
$ phpcs
It will automatically find phpcs.xml and apply its rules.
These rules have been selected to be similar to Wordpress's style guide,
which we encourage you to follow:
https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/
The main difference is that we use four spaces for indentation, not hard
tabs. I highly recommend using an editor that supports
http://editorconfig.org/ so that your editor automatically uses the
right settings for this project.
-->
<file>.</file>
<exclude-pattern>vendor/*</exclude-pattern>
<exclude-pattern>includes/admin/libraries/plugin-update-checker/*</exclude-pattern>
<arg name="extensions" value="php,inc,lib"/>
<arg value="n"/>
<!-- To get a list of all currently enabled sniffs, run: phpcs -e -->
<!-- To get a list of all available standards, run phpcs -i. To get a list of
the sniffs in a standard, run phpcs -e \-\-standard=STANDARD -->
<!-- For whatever reason, to get the WordPress rules to work, you have to
include all of WordPress, which includes a bunch of other rules not in
the WordPress namespaces. -->
<rule ref="WordPress">
<!-- TODO: enable these rules: -->
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.WP.I18n.MissingTranslatorsComment" />
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar" />
<!-- We currently don't want these rules that WordPress imports: -->
<exclude name="Generic.Classes.OpeningBraceSameLine.BraceOnNewLine" />
<exclude name="Generic.Classes.OpeningBraceSameLine.SpaceBeforeBrace" />
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedELSE" />
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedELSEIF" />
<exclude name="Generic.CodeAnalysis.EmptyStatement.DetectedIF" />
<exclude name="Generic.Commenting.DocComment.Empty" />
<exclude name="Generic.Commenting.DocComment.LongNotCapital" />
<exclude name="Generic.Commenting.DocComment.MissingShort" />
<exclude name="Generic.Commenting.DocComment.ShortNotCapital" />
<exclude name="Generic.Commenting.DocComment.SpacingAfter" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags" />
<exclude name="Generic.Files.EndFileNewline.NotFound" />
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.BraceOnNewLine" />
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.ContentAfterBrace" />
<exclude name="Generic.Functions.OpeningFunctionBraceKernighanRitchie.SpaceBeforeBrace" />
<exclude name="Generic.PHP.ForbiddenFunctions.FoundWithAlternative" />
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BreakIndent" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.SpaceBeforeColonCASE" />
<exclude name="PSR2.Files.ClosingTag.NotAllowed" />
<exclude name="Squiz.Commenting.BlockComment.CloserSameLine" />
<exclude name="Squiz.Commenting.BlockComment.NoCapital" />
<exclude name="Squiz.Commenting.BlockComment.NoEmptyLineBefore" />
<exclude name="Squiz.Commenting.BlockComment.NoNewLine" />
<exclude name="Squiz.Commenting.BlockComment.WrongEnd" />
<exclude name="Squiz.Commenting.ClassComment.Missing" />
<exclude name="Squiz.Commenting.ClassComment.SpacingAfter" />
<exclude name="Squiz.Commenting.ClassComment.WrongStyle" />
<exclude name="Squiz.Commenting.DocCommentAlignment.NoSpaceAfterStar" />
<exclude name="Squiz.Commenting.DocCommentAlignment.SpaceBeforeStar" />
<exclude name="Squiz.Commenting.FileComment.EmptyAuthorTag" />
<exclude name="Squiz.Commenting.FileComment.Missing" />
<exclude name="Squiz.Commenting.FileComment.MissingPackageTag" />
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment" />
<exclude name="Squiz.Commenting.FileComment.SpacingAfterOpen" />
<exclude name="Squiz.Commenting.FileComment.WrongStyle" />
<!-- <exclude name="Squiz.Commenting.FunctionComment.ExtraParamComment" /> -->
<!-- <exclude name="Squiz.Commenting.FunctionComment.IncorrectTypeHint" /> -->
<!-- <exclude name="Squiz.Commenting.FunctionComment.InvalidNoReturn" /> -->
<!-- <exclude name="Squiz.Commenting.FunctionComment.InvalidReturnVoid" /> -->
<exclude name="Squiz.Commenting.FunctionComment.Missing" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamComment" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamName" />
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag" />
<exclude name="Squiz.Commenting.FunctionComment.ParamCommentFullStop" />
<!-- <exclude name="Squiz.Commenting.FunctionComment.ParamNameNoMatch" /> -->
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfter" />
<exclude name="Squiz.Commenting.FunctionComment.SpacingAfterParamType" />
<exclude name="Squiz.Commenting.FunctionComment.WrongStyle" />
<exclude name="Squiz.Commenting.FunctionCommentThrowTag.Missing" />
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar" />
<exclude name="Squiz.Commenting.InlineComment.NoSpaceBefore" />
<exclude name="Squiz.Commenting.InlineComment.SpacingAfter" />
<exclude name="Squiz.Commenting.InlineComment.SpacingBefore" />
<exclude name="Squiz.Commenting.InlineComment.WrongStyle" />
<exclude name="Squiz.Commenting.VariableComment.Missing" />
<exclude name="Squiz.Commenting.VariableComment.MissingVar" />
<exclude name="Squiz.Commenting.VariableComment.WrongStyle" />
<exclude name="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace" />
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseBrace" />
<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis" />
<!-- <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword" /> -->
<exclude name="Squiz.PHP.DisallowMultipleAssignments.Found" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentAfterOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeEnd" />
<exclude name="Squiz.PHP.EmbeddedPhp.ContentBeforeOpen" />
<exclude name="Squiz.PHP.EmbeddedPhp.NoSemicolon" />
<exclude name="Squiz.PHP.EmbeddedPhp.SpacingBeforeClose" />
<exclude name="Squiz.Strings.ConcatenationSpacing.PaddingFound" />
<exclude name="Squiz.Strings.DoubleQuoteUsage.NotRequired" />
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EmptyLines" />
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile" />
<!-- <exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndLine" /> -->
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.ArrayItemNoNewLine" /> -->
<exclude name="WordPress.Arrays.ArrayDeclarationSpacing.AssociativeKeyFound" />
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.CloseBraceNewLine" /> -->
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceAfterArrayOpener" /> -->
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.NoSpaceBeforeArrayCloser" /> -->
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.SpaceAfterKeyword" /> -->
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.SpaceBeforeArrayCloser" /> -->
<!-- <exclude name="WordPress.Arrays.ArrayDeclarationSpacing.SpaceInEmptyArray" /> -->
<exclude name="WordPress.Arrays.ArrayIndentation.CloseBraceNotAligned" />
<exclude name="WordPress.Arrays.ArrayIndentation.ItemNotAligned" />
<exclude name="WordPress.Arrays.ArrayIndentation.MultiLineArrayItemNotAligned" />
<exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.NoSpacesAroundArrayKeys" />
<!-- <exclude name="WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys" /> -->
<exclude name="WordPress.Arrays.CommaAfterArrayItem.CommaAfterLast" />
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoComma" />
<exclude name="WordPress.Arrays.CommaAfterArrayItem.NoSpaceAfterComma" />
<exclude name="WordPress.Arrays.CommaAfterArrayItem.SpaceAfterComma" />
<exclude name="WordPress.Arrays.CommaAfterArrayItem.SpaceBeforeComma" />
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
<exclude name="WordPress.PHP.DisallowShortTernary.Found"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda" />
<!-- <exclude name="WordPress.WhiteSpace.CastStructureSpacing.NoSpaceBeforeOpenParenthesis" /> -->
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.BlankLineAfterEnd" /> -->
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterCloseParenthesis" /> -->
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceAfterOpenParenthesis" /> -->
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceBeforeCloseParenthesis" /> -->
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.ExtraSpaceBeforeOpenParenthesis" /> -->
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterCloseParenthesis" />
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterOpenParenthesis" />
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen" /> -->
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeCloseParenthesis" />
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis" /> -->
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBetweenStructureColon" />
<exclude name="WordPress.WhiteSpace.ControlStructureSpacing.OpenBraceNotSameLine" />
<!-- <exclude name="WordPress.WhiteSpace.ControlStructureSpacing.SpaceBeforeFunctionOpenParenthesis" /> -->
<exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceAfter" />
<!-- <exclude name="WordPress.WhiteSpace.OperatorSpacing.NoSpaceBefore" /> -->
<!-- <exclude name="WordPress.WhiteSpace.OperatorSpacing.SpacingAfter" /> -->
<!-- <exclude name="WordPress.WhiteSpace.OperatorSpacing.SpacingBefore" /> -->
</rule>
<!-- Keeping these ones: -->
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Debug.ClosureLinter"/>
<rule ref="Generic.Files.ByteOrderMark"/>
<rule ref="Generic.Files.LineEndings"/>
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.NamingConventions.ConstructorName"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.DeprecatedFunctions"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="indent" value="4"/>
<property name="ignoreIndentationTokens" type="array" value="T_COMMENT,T_DOC_COMMENT_OPEN_TAG"/>
</properties>
</rule>
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
<property name="requiredSpacesAfterOpen" value="1"/>
<property name="requiredSpacesBeforeClose" value="1"/>
</properties>
</rule>
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
<rule ref="PEAR.Functions.FunctionCallSignature">
<properties>
<property name="requiredSpacesAfterOpen" value="1"/>
<property name="requiredSpacesBeforeClose" value="1"/>
</properties>
<exclude name="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.CloseBracketLine"/>
<exclude name="PEAR.Functions.FunctionCallSignature.MultipleArguments"/>
</rule>
<rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
<rule ref="PEAR.NamingConventions.ValidClassName"/>
<!-- Maybe these rules will be enabled in the future: -->
<!-- <rule ref="Generic.Files.LineLength"/> -->
<!-- <rule ref="Generic.Commenting.DocComment"/> -->
<!-- Rejecting these ones: -->
<!-- <rule ref="Generic.Commenting.Todo"/> -->
<!-- <rule ref="Generic.CodeAnalysis.EmptyStatement"/> -->
<!-- <rule ref="Generic.Formatting.MultipleStatementAlignment"/> -->
<!-- <rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/> -->
<!-- <rule ref="Generic.PHP.DisallowShortOpenTag"/> -->
<!-- <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/> -->
<!-- <rule ref="PEAR.NamingConventions.ValidFunctionName"/> -->
<!-- <rule ref="PEAR.NamingConventions.ValidVariableName"/> -->
<!-- <rule ref="PSR2.Files.ClosingTag"/> -->
<!-- <rule ref="Squiz.PHP.ForbiddenFunctions"/> -->
<!-- <rule ref="Generic.Arrays.DisallowLongArraySyntax"/> -->
<rule ref="WordPress.Security.ValidatedSanitizedInput">
<properties>
<property name="customUnslashingSanitizingFunctions" type="array">
<element value="dt_recursive_sanitize_array" />
</property>
</properties>
</rule>
</ruleset>