]> git.openstreetmap.org Git - nominatim.git/blob - php-lint-rules.xml
Merge pull request #522 from mtmail/PSR2-arrays
[nominatim.git] / php-lint-rules.xml
1 <?xml version="1.0"?>
2 <ruleset name="Nominatim Standard">
3
4   <description>Nominatim coding standard</description>
5
6   <!-- based on another standard, you can find it here -->
7   <!-- /usr/share/php/PHP/CodeSniffer/Standards/PSR2/ruleset.xml -->
8   <!-- https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/PSR2/ruleset.xml -->
9   <rule ref="PSR2"/>
10
11
12
13
14   <!-- currently 300 warnings, we set a limit later -->
15   <rule ref="Generic.Files.LineLength">
16     <properties>
17      <property name="lineLimit" value="9999"/>
18      <property name="absoluteLineLimit" value="0"/>
19     </properties>
20   </rule>
21
22
23
24   <!-- **************************************************************
25        DOCUMENTATION
26        ************************************************************** -->
27
28   <rule ref="PEAR.Commenting.FileComment.Missing">
29     <severity>0</severity>
30   </rule>
31   <rule ref="PEAR.Commenting.ClassComment.Missing">
32     <severity>0</severity>
33   </rule>    
34   <rule ref="PEAR.Commenting.FunctionComment.Missing">
35     <severity>0</severity>
36   </rule>
37
38
39
40
41   <!-- **************************************************************
42        COMMENTS
43        ************************************************************** -->
44
45   <!-- We allow comments after statements -->
46   <rule ref="Squiz.Commenting.PostStatementComment.Found">
47     <severity>0</severity>
48   </rule>
49   <!-- ... even without space e.g. //some words -->
50   <rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
51     <severity>0</severity>
52   </rule>
53
54   <!-- Comments don't have to start uppercase -->
55   <rule ref="Squiz.Commenting.InlineComment.NotCapital">
56     <severity>0</severity>
57   </rule>
58   <!-- Comments don't have to end with one of .!? -->
59   <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
60     <severity>0</severity>
61   </rule>
62
63   <!-- we don't need '} // functionname()' at end of large blocks -->
64   <rule ref="Squiz.Commenting.ClosingDeclarationComment.Missing">
65     <severity>0</severity>
66   </rule>
67   <!-- .. same for conditions -->
68   <rule ref="Squiz.Commenting.LongConditionClosingComment.Missing">
69     <severity>0</severity>
70   </rule>
71
72
73
74
75
76   <!-- **************************************************************
77        INDENTATION, SPACING
78        ************************************************************** -->
79
80   <!-- We use tabs -->
81   <rule ref="Generic.WhiteSpace.DisallowTabIndent.TabsUsed">
82     <severity>0</severity>
83   </rule>
84
85   <!-- We don't need 2 blank lines after function -->
86   <rule ref="Squiz.WhiteSpace.FunctionSpacing.After">
87     <severity>0</severity>
88   </rule>
89
90   <!-- Aligned looks nicer, but causes too many warnings currently -->
91   <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSame">
92     <severity>0</severity>
93   </rule>
94
95   <!-- Aligned looks nicer, but causes too many warnings currently -->
96   <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
97     <severity>0</severity>
98   </rule>
99
100
101
102
103
104
105
106   <!-- **************************************************************
107        VARIABLES
108        ************************************************************** -->
109
110   <!-- CONST_this_var is fine, we don't need ConstThisVar -->
111   <rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
112     <severity>0</severity>
113   </rule>
114
115   <!-- simply disagree with "Each line in an array declaration must end in a comma" -->
116   <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
117     <severity>0</severity>
118   </rule>
119   <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
120     <severity>0</severity>
121   </rule>
122
123   <!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
124   <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
125     <severity>0</severity>
126   </rule>
127
128
129
130
131   <!-- **************************************************************
132        CONTROL STRUCTURES
133        ************************************************************** -->
134
135   <!-- we allow "if (a) echo 'b'" without brackets -->
136   <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
137     <severity>0</severity>
138   </rule>
139   <rule ref="Generic.ControlStructures.InlineControlStructure.Discouraged">
140     <severity>0</severity>
141   </rule>
142   <rule ref="Squiz.PHP.DisallowInlineIf.Found">
143     <severity>0</severity>
144   </rule>
145
146   <!-- We allow "if (a)". No need for "if (a === TRUE)" -->
147   <rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
148     <severity>0</severity>
149   </rule>
150   <!-- ... same for "if (!a)" -->
151   <rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
152     <severity>0</severity>
153   </rule>
154
155   <!-- We allow
156               if (a)
157               {
158   -->
159   <rule ref="PEAR.ControlStructures.MultiLineCondition.NewlineBeforeOpenBrace">
160     <severity>0</severity>
161   </rule>
162   <!-- ... same -->
163   <rule ref="Squiz.WhiteSpace.ControlStructureSpacing.NoLineAfterClose">
164     <severity>0</severity>
165   </rule>
166   <!-- ... same for foreach/while etc -->
167   <rule ref="PEAR.ControlStructures.ControlSignature">
168     <severity>0</severity>
169   </rule>
170   <!-- ... same -->
171   <rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace.SpacingBeforeClose">
172     <severity>0</severity>
173   </rule>
174
175
176 </ruleset>