This repository was archived by the owner on Nov 5, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathruleset.xml
354 lines (354 loc) · 11.1 KB
/
ruleset.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
<?xml version="1.0" encoding="UTF-8" ?>
<ruleset name="CodeIgniter4">
<description>CodeIgniter 4 coding standard for PHP_CodeSniffer</description>
<!--
* CodeIgniter 4 coding standard for PHP_CodeSniffer
*
* @author Louis Linehan <louis.linehan@gmail.com>
* @copyright 2017 British Columbia Institute of Technology
* @license https://github.com/bcit-ci/CodeIgniter4-Standard/blob/master/LICENSE MIT License
-->
<!--
Files MUST have a doc block comment.
Checks file comment tag format and order.
-->
<rule ref="CodeIgniter4.Commenting.FileComment">
<properties>
<property name="error" value="true"/>
</properties>
</rule>
<!--
Classes MUST have a doc block comment.
-->
<rule ref="Squiz.Commenting.ClassComment"/>
<!--
Checks class comment tag format and order.
-->
<rule ref="CodeIgniter4.Commenting.ClassComment"/>
<!--
Allow class tags.
-->
<rule ref="Squiz.Commenting.ClassComment.TagNotAllowed">
<severity>0</severity>
</rule>
<!--
Properties MUST have a doc block comment.
-->
<rule ref="Squiz.Commenting.VariableComment"/>
<!--
Methods and functions MUST have a doc block comment.
-->
<rule ref="Squiz.Commenting.FunctionComment"/>
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentNotCapital">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ParamCommentFullStop">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.EmptyThrows">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ThrowsNotCapital">
<severity>0</severity>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.ThrowsNoFullStop">
<severity>0</severity>
</rule>
<!--
Doc block comment alignment.
-->
<rule ref="Squiz.Commenting.DocCommentAlignment"/>
<!--
Warn about //... comments after statments.
-->
<rule ref="Squiz.Commenting.PostStatementComment">
<type>warning</type>
<exclude phpcbf-only="true" name="Squiz.Commenting.PostStatementComment.Found"/>
</rule>
<!--
Change the error message.
-->
<rule ref="Squiz.Commenting.PostStatementComment.Found">
<message>Comments should not appear after statements</message>
</rule>
<!--
Doc block comment format and spacing.
-->
<rule ref="Generic.Commenting.DocComment"/>
<!--
Tab width is 4 spaces (for phpcs)
-->
<arg name="tab-width" value="4"/>
<!--
Ignore application/Views/ directory.
Ignore application/ThirdParty/ directory.
Ignore system/ThirdParty/ directory.
There could be a mix of styles in ThirdParty and View files
could contain all sorts of indentation, alignments and scopes.
@todo subject to change.
-->
<arg
name="ignore"
value="*/application/Views/*,*/application/ThirdParty/*,*/system/ThirdParty/*"/>
<!--
Files MUST use UTF-8 character set encoding without BOM
-->
<rule ref="Generic.Files.ByteOrderMark"/>
<!--
Files MUST NOT have the PHP closing tag '?>' at the end as the last content.
Files MUST END with a single empty line.
-->
<rule ref="PSR2.Files.EndFileNewline"/>
<!--
Disallow short php open tags "<?".
-->
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
<!--
Allow short php echo tags "<?=".
-->
<rule ref="Generic.PHP.DisallowShortOpenTag.EchoFound">
<severity>0</severity>
</rule>
<!--
User defined constants must be upper case.
-->
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<!--
Boolean or "||" must be used. Not logical "or".
-->
<rule ref="CodeIgniter4.Operators.BooleanOr"/>
<!--
Boolean and "&&" must be used. Not logical "and".
-->
<rule ref="CodeIgniter4.Operators.BooleanAnd"/>
<!--
Boolean not "!" must have a space after.
-->
<rule ref="CodeIgniter4.WhiteSpace.BooleanNotSpaceAfter"/>
<!--
Is identical "===" must be used. Not is equal "==".
-->
<rule ref="CodeIgniter4.Operators.IsIdentical"/>
<!--
Is not identical "!==" must be used. Not is not equal "!=".
-->
<rule ref="CodeIgniter4.Operators.IsNotIdentical"/>
<!--
Warning for discouraged functions.
'print_r',
'var_dump'
@todo subject to change.
-->
<rule ref="CodeIgniter4.PHP.DiscouragedFunctions"/>
<!--
White space. (Unnecessary tabs, spaces and lines).
There must not be white space at the start of the file.
There must not be white space at the end of lines.
There must not be white space on empty lines.
There must not be white space at the start of the file.
-->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
<!--
Checks for more than one consecutive empty line.
-->
<rule ref="CodeIgniter4.WhiteSpace.VerticalEmptyLines"/>
<!--
There should be one class per file, execept for cases where
breaking this rule makes more sense.
'Exception.php',
'Exceptions.php',
'CustomExceptions.php',
'Response.php'
@todo subject to change.
-->
<rule ref="CodeIgniter4.Files.OneClassPerFile"/>
<rule ref="Generic.Files.OneInterfacePerFile"/>
<rule ref="Generic.Files.OneTraitPerFile"/>
<!--
Checks tabs are used for indenting scopes.
-->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="tabIndent" value="true"/>
</properties>
</rule>
<!--
Checks tabs are used for indenting.
-->
<rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
<!--
Checks tabs are not used in alignment.
-->
<rule ref="CodeIgniter4.WhiteSpace.DisallowTabsInAlignment"/>
<!--
Checks line endings are unix "\n".
-->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\n"/>
</properties>
</rule>
<!--
Checks opening function brace "{" is BsdAllman.
-->
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
<!--
Checks control structures are BsdAllman.
-->
<rule ref="CodeIgniter4.ControlStructures.AllmanControlSignature"/>
<!--
Checks control structures are spaced properly.
-->
<rule ref="CodeIgniter4.ControlStructures.ControlStructureSpacing"/>
<!--
Checks function arguments are spaced properly.
-->
<rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
<!--
Checks visibilty is declared for method scopes.
-->
<rule ref="Squiz.Scope.MethodScope"/>
<!--
Checks scope keywords are spaced properly.
-->
<rule ref="Squiz.WhiteSpace.ScopeKeywordSpacing"/>
<!--
Disallow multiple statements on one line.
-->
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
<!--
Use single quotes unless the string contains single quotes.
-->
<rule ref="Squiz.Strings.DoubleQuoteUsage"/>
<!--
Warning for lines exceeding 120 characters.
-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="250"/>
<property name="absoluteLineLimit" value="0"/>
</properties>
</rule>
<!--
Checks function and method arguments with default values are at the
end of the argument list.
-->
<rule ref="PEAR.Functions.ValidDefaultValue"/>
<!--
Checks single and multi-line function declarations are styled properly.
-->
<rule ref="CodeIgniter4.Functions.FunctionDeclaration"/>
<!--
Checks arguments in functions are spaced properly.
-->
<rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
<properties>
<property name="equalsSpacing" value="1"/>
</properties>
</rule>
<!--
Checks there are no blank lines after a function opening brace.
-->
<rule ref="Squiz.WhiteSpace.FunctionOpeningBraceSpace"/>
<!--
Checks there are no blank lines before a function closing brace.
-->
<rule ref="CodeIgniter4.WhiteSpace.FunctionClosingBraceSpace"/>
<!--
The keyword elseif SHOULD be used instead of else if so that all control
keywords look like single words.
-->
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
<!--
Checks for each declarations are styled properly.
-->
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<!--
Checks for loop declarations are styled properly.
-->
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
<!--
Checks inline control structures and fixes with phpcbf.
-->
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!--
Warning for todo items.
-->
<rule ref="Generic.Commenting.Todo"/>
<!--
Check concatenation spacing and if concatenation is needed.
-->
<rule ref="Squiz.Strings.ConcatenationSpacing">
<properties>
<property name="spacing" value="1"/>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!--
Check operator spacing.
-->
<rule ref="Squiz.WhiteSpace.OperatorSpacing">
<properties>
<property name="ignoreNewlines" value="true"/>
</properties>
</rule>
<!--
Filename must match class if it contains one.
-->
<rule ref="CodeIgniter4.Files.FilenameMatchesClass"/>
<!--
Checks namespace declaration.
-->
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
<!--
Checks use declaration.
-->
<rule ref="PSR2.Namespaces.UseDeclaration"/>
<!--
Checks PHP keywords are lower case.
-->
<rule ref="Generic.PHP.LowerCaseKeyword"/>
<!--
PHP constants "true", "false" and "null" must be lower case.
-->
<rule ref="Generic.PHP.LowerCaseConstant"/>
<!--
Checks variable names are lowerCamelCase().
This is a loose check and will allow acronyms.
-->
<rule ref="CodeIgniter4.NamingConventions.ValidVariableName"/>
<!--
Checks method names are lowerCamelCase() except allowed public method names.
This is a loose check and will allow acronyms.
'_remap'
@todo subject to change.
-->
<rule ref="CodeIgniter4.NamingConventions.ValidMethodName"/>
<!--
Checks function names (outside scope) are snake_case.
-->
<rule ref="CodeIgniter4.NamingConventions.ValidFunctionName"/>
<!--
Checks array bracket spaces.
-->
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<!--
Check array declaration, indentation, alignment and that the last item
has a trailing comma.
Checks arrays are declared as "[]" not "array()".
-->
<rule ref="CodeIgniter4.Arrays.ArrayDeclaration"/>
<!--
Checks statments on subsequent lines are aligned. (line up the "=").
-->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="error" value="true"/>
</properties>
</rule>
<!--
Checks *_helper.php files only contain functions
and that the filename is lower snake_case.
-->
<rule ref="CodeIgniter4.Files.HelperFile"/>
</ruleset>