Repository navigation
Expand file tree
/
Copy pathcoding-standards.xml
More file actions
110 lines (77 loc) · 6.1 KB
/
Copy pathcoding-standards.xml
File metadata and controls
110 lines (77 loc) · 6.1 KB
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
<?xml version="1.0"?>
<!-- in command line, use -s to find out what rule was applied for each error -->
<ruleset name="zebra">
<description>Coding standards</description>
<file>Zebra_cURL.php</file>
<ini name="memory_limit" value="64M"/>
<arg name="report-width" value="130"/>
<rule ref="PSR12">
<!-- Let the Git manage the EOL cross the platforms. -->
<exclude name="Generic.Files.LineEndings.InvalidEOLChar"/>
<!-- Don't warn about lines being too long -->
<exclude name="Generic.Files.LineLength.TooLong"/>
<!-- Allow class names to be written in snake_case -->
<exclude name="Squiz.Classes.ValidClassName.NotCamelCaps"/>
<!-- The class is deliberately not in a namespace - putting it in one is a major version's work -->
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace"/>
<!-- Private properties are prefixed with an underscore to indicate visibility -->
<exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
<!-- Don't force braces being on the same line as the function's declaration -->
<exclude name="PSR2.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="Squiz.Classes.ClassDeclaration.OpenBraceNewLine" />
<exclude name="PEAR.Functions.FunctionDeclaration.BraceOnSameLine" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine" />
<!-- Allow method names to be written in snake_case -->
<exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
<!-- Allow blank line before the closing brace of a class -->
<exclude name="PSR2.Classes.ClassDeclaration.CloseBraceAfterBody" />
<!-- Allow blank line after the CASE and DEFAULT keywords -->
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineCASE" />
<exclude name="PSR2.ControlStructures.SwitchDeclaration.BodyOnNextLineDEFAULT" />
<!-- I write queries as multiline but the first thing after the opening parenthesis is the opening quote -->
<exclude name="PSR2.Methods.FunctionCallSignature.ContentAfterOpenBracket" />
<!-- PSR2 forbids every blank line in a multi-line call; the CommentedEmptyLineInFunctionCall rule below
allows a blank when the line after it is a comment, so array_merge() reads as a labelled list, and
reports every other blank. FirstArgumentPosition is off so the first labelling comment can sit a
blank line below the opening parenthesis. -->
<exclude name="PSR2.Methods.FunctionCallSignature.EmptyLine" />
<exclude name="PSR2.Methods.FunctionCallSignature.FirstArgumentPosition" />
<!-- Allow blank line before the closing brace of a function -->
<exclude name="PSR2.Methods.FunctionClosingBrace.SpacingBeforeClose" />
<!-- Allow private methods to have underscore as their name's first character -->
<exclude name="PSR2.Methods.MethodDeclaration.Underscore" />
<!-- Allow blank line after the opening brace of a class -->
<exclude name="PSR12.Classes.OpeningBraceSpace.Found" />
<!-- In multi-line control structures, the first expression can be on the next line -->
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.FirstExpressionLine" />
<!-- In multi-line control structures, the parenthesis after the last expression can be on the next line -->
<exclude name="PSR12.ControlStructures.ControlStructureSpacing.CloseParenthesisLine" />
<!-- Allow blank lines at the start/end of control structures -->
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />
<exclude name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingBeforeClose" />
<!-- Single statement bodies are written without braces throughout this library - "if (!$this->_queue) return" -->
<exclude name="Generic.ControlStructures.InlineControlStructure"/>
<!-- Covered by the FunctionKeywordSpacing rule below, which allows the space on a named declaration
and forbids it on a closure. Both codes are named because the Squiz sniff extends the PEAR one. -->
<exclude name="PEAR.Functions.FunctionDeclaration.SpaceAfterFunction" />
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction" />
<!-- A closure short enough to sit on one line is written on one line - "function($value) { return $value; }".
The Kernighan/Ritchie rule below still checks named declarations, its checkClosures property being off. -->
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace" />
<exclude name="Squiz.WhiteSpace.ScopeClosingBrace.ContentBefore" />
<!-- Covered by the ClosureAwareMultipleStatements rule below, which allows the statement inside a one line closure -->
<exclude name="Generic.Formatting.DisallowMultipleStatements" />
</rule>
<!-- One space after the "function" keyword when a name follows it, none when it does not - so
"function get($urls)" and "function($value) { ... }" are both correct. -->
<rule ref="tests/standards/Zebra/Sniffs/Functions/FunctionKeywordSpacingSniff.php" />
<!-- Each statement on a line by itself, except inside a closure - so "array_map(function($row) { return
$row['id']; }, $rows)" is fine while "$a = 1; $b = 2;" is still reported. -->
<rule ref="tests/standards/Zebra/Sniffs/Formatting/ClosureAwareMultipleStatementsSniff.php" />
<!-- Blank lines in a multi-line call are reported unless the line after the blank is a comment, so a call
written as a comment-labelled list of arguments is allowed while a stray blank between expressions is not. -->
<rule ref="tests/standards/Zebra/Sniffs/Formatting/CommentedEmptyLineInFunctionCallSniff.php" />
<!-- Function declarations follow the "Kernighan/Ritchie style". The function brace is on the same line as the
function declaration. One space is required between the closing parenthesis and the brace. -->
<rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie" />
</ruleset>