]> git.openstreetmap.org Git - nominatim.git/blob - phpcs.xml
Merge branch 'PSR2-fixes-for-settings' of https://github.com/mtmail/Nominatim into...
[nominatim.git] / phpcs.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   <!-- "A file should declare new symbols (classes, functions, constants, etc.) and cause no
24     other side effects, or it should execute logic with side effects, but should not do both."
25     ... we have too many script and includes to be able to enforce that.
26      -->
27   <rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
28     <severity>0</severity>
29   </rule>
30
31
32
33   <!-- **************************************************************
34        DOCUMENTATION
35        ************************************************************** -->
36
37   <rule ref="PEAR.Commenting.FunctionComment.Missing">
38     <severity>0</severity>
39   </rule>
40
41
42
43
44   <!-- **************************************************************
45        COMMENTS
46        ************************************************************** -->
47
48   <!-- any comments in the lines before function() are better than forcing
49        a PHPdoc style right now -->
50   <rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
51     <severity>0</severity>
52   </rule>
53
54   <!-- We allow comments after statements -->
55   <rule ref="Squiz.Commenting.PostStatementComment.Found">
56     <severity>0</severity>
57   </rule>
58   <!-- ... even without space e.g. //some words -->
59   <rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
60     <severity>0</severity>
61   </rule>
62   <!-- blank lines after inline comments are fine -->
63   <rule ref="Squiz.Commenting.InlineComment.SpacingAfter">
64     <severity>0</severity>
65   </rule>
66
67   <!-- Comments don't have to start uppercase -->
68   <rule ref="Squiz.Commenting.InlineComment.NotCapital">
69     <severity>0</severity>
70   </rule>
71   <!-- Comments don't have to end with one of .!? -->
72   <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
73     <severity>0</severity>
74   </rule>
75   <!-- Empty comments are fine -->
76   <rule ref="Squiz.Commenting.InlineComment.Empty">
77     <severity>0</severity>
78   </rule>
79
80
81
82
83   <!-- **************************************************************
84        INDENTATION, SPACING
85        ************************************************************** -->
86
87   <!-- We don't need 2 blank lines after function -->
88   <rule ref="Squiz.WhiteSpace.FunctionSpacing.After">
89     <severity>0</severity>
90   </rule>
91
92   <!-- Aligned looks nicer, but causes too many warnings currently -->
93   <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSame">
94     <severity>0</severity>
95   </rule>
96   <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
97     <severity>0</severity>
98   </rule>
99
100   <!-- Aligned looks nicer, but causes too many warnings currently -->
101   <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
102     <severity>0</severity>
103   </rule>
104
105
106
107
108
109
110
111   <!-- **************************************************************
112        VARIABLES
113        ************************************************************** -->
114
115   <!-- CONST_this_var is fine, we don't need ConstThisVar -->
116   <rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
117     <severity>0</severity>
118   </rule>
119
120   <!-- simply disagree with "Each line in an array declaration must end in a comma" -->
121   <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
122     <severity>0</severity>
123   </rule>
124   <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
125     <severity>0</severity>
126   </rule>
127
128   <!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
129   <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
130     <severity>0</severity>
131   </rule>
132
133
134
135
136   <!-- **************************************************************
137        CONTROL STRUCTURES
138        ************************************************************** -->
139
140   <!-- we allow "if (a) echo 'b'" without brackets -->
141   <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
142     <severity>0</severity>
143   </rule>
144
145   <!-- We allow "if (a)". No need for "if (a === TRUE)" -->
146   <rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
147     <severity>0</severity>
148   </rule>
149   <!-- ... same for "if (!a)" -->
150   <rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
151     <severity>0</severity>
152   </rule>
153
154
155
156 </ruleset>