forked from domenypl/Domeny.pl-coding-standard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ruleset.xml
142 lines (115 loc) · 6.17 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
<?xml version="1.0"?>
<ruleset name="Symfony2DomenyPL">
<description>The Domeny.pl variant on the Symfony2 coding standard.</description>
<!-- There should not be any code in the bundle Resources directory. -->
<exclude-pattern>*/Resources/*</exclude-pattern>
<!--
See the [documented coding standard](http://symfony.com/doc/current/contributing/code/standards.html)
This CodeSniffer standard does not yet enforce the following:
# Structure
* Declare class properties before methods;
* Declare public methods first, then protected ones and finally private ones.
* Use namespaces for all classes;
* Add PHPDoc blocks for all classes, methods, and functions;
* The @package and @subpackage annotations are not used.
* Use uppercase strings for constants with words separated with underscores
# Naming Conventions
* Use underscores for option, argument, parameter names;
-->
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<rule ref="Generic.Formatting.SpaceAfterCast"/>
<rule ref="Generic.Functions.CallTimePassByReference"/>
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
<rule ref="Generic.PHP.LowerCaseConstant"/>
<rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
<rule ref="Squiz.ControlStructures.ControlSignature"/>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
<rule ref="Squiz.ControlStructures.LowercaseDeclaration"/>
<rule ref="Squiz.PHP.LowercasePHPFunctions"/>
<rule ref="Squiz.Scope.MemberVarScope"/>
<!-- We provide our own subclass of PEAR's ClassComment and FunctionComment sniff, but these will do: -->
<rule ref="PEAR.Commenting.InlineComment"/>
<!-- Import Zend coding standard (which in turn imports PEAR) -->
<rule ref="Zend">
<!-- but exclude their code analyzer -->
<exclude name="Zend.Debug.CodeAnalyzer"/>
<!-- covered by Squiz ControlSignature, which enforces try/catch as well -->
<exclude name="PEAR.ControlStructures.ControlSignature"/>
<exclude name="PEAR.Commenting.FunctionComment.SpacingBeforeTags"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket"/>
<exclude name="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket"/>
<!-- do not check line length -->
<exclude name="Generic.Files.LineLength"/>
</rule>
<!-- Don't enforce Zend's private member underscores -->
<rule ref="Zend.NamingConventions.ValidVariableName.PrivateNoUnderscore">
<severity>0</severity>
</rule>
<!-- Ignore variables that contains numbers -->
<rule ref="Zend.NamingConventions.ValidVariableName.ContainsNumbers">
<severity>0</severity>
</rule>
<!-- In practice, Symfony2 spaces multiline function calls differently than Zend -->
<rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
<severity>0</severity>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
<severity>0</severity>
</rule>
<rule ref="Symfony2DomenyPL.Commenting.FunctionComment.MissingParamComment">
<severity>0</severity>
</rule>
<rule ref="Symfony2DomenyPL.Commenting.FunctionComment.SpacingBeforeTags">
<severity>0</severity>
</rule>
<rule ref="Symfony2DomenyPL.Commenting.FunctionComment.ParameterNamesNotAligned">
<severity>0</severity>
</rule>
<rule ref="Symfony2DomenyPL.Commenting.ClassComment.SpacingBeforeTags">
<message>There should always be a description, followed by a blank line, before the tags of a class comment.</message>
</rule>
<!-- 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="requiredSpacesAfterOpen" value="1" />
<property name="equalsSpacing" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
<!-- 4.6 Method and Function Calls -->
<!-- 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 be one space after the opening parenthesis, and there MUST be one 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="PSR2.Methods.FunctionCallSignature">
<properties>
<property name="requiredSpacesAfterOpen" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
<!-- 5. Control Structures -->
<!-- The general style rules for control structures are as follows:
There MUST be one space after the control structure keyword
There MUST be one space after the opening parenthesis
There MUST be one space before the closing parenthesis
There MUST be one space between the closing parenthesis and the opening brace
The structure body MUST be indented once
The closing brace MUST be on the next line after the body -->
<rule ref="PSR2.ControlStructures.ControlStructureSpacing">
<properties>
<property name="requiredSpacesAfterOpen" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
<rule ref="Squiz.ControlStructures.ForEachLoopDeclaration">
<properties>
<property name="requiredSpacesAfterOpen" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
<rule ref="Squiz.ControlStructures.ForLoopDeclaration">
<properties>
<property name="requiredSpacesAfterOpen" value="1" />
<property name="requiredSpacesBeforeClose" value="1" />
</properties>
</rule>
</ruleset>