]> git.openstreetmap.org Git - nominatim.git/blob - phpcs.xml
clean up docs for lookup call
[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   <exclude-pattern>./lib/template/*html*</exclude-pattern>
12   <exclude-pattern>./lib/template/includes/</exclude-pattern>
13   <exclude-pattern>./module/</exclude-pattern>
14   <exclude-pattern>./website/css</exclude-pattern>
15   <exclude-pattern>./website/js</exclude-pattern>
16
17   <rule ref="Generic.Files.LineLength">
18     <properties>
19      <property name="lineLimit" value="194"/>
20      <property name="absoluteLineLimit" value="194"/>
21     </properties>
22   </rule>
23
24
25   <!-- "A file should declare new symbols (classes, functions, constants, etc.) and cause no
26     other side effects, or it should execute logic with side effects, but should not do both."
27     ... we have too many script and includes to be able to enforce that.
28      -->
29   <rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
30     <severity>0</severity>
31   </rule>
32
33
34
35   <!-- eval, system, etc -->
36   <rule ref="Generic.PHP.ForbiddenFunctions">
37     <properties>
38       <property name="forbiddenFunctions" type="array" value="sizeof=>count,delete=>unset,print=>echo,create_function=>null,eval=>null"/>
39     </properties>
40   </rule>
41
42   <!-- **************************************************************
43        DOCUMENTATION
44        ************************************************************** -->
45
46   <rule ref="PEAR.Commenting.FunctionComment.Missing">
47     <severity>0</severity>
48   </rule>
49
50
51
52
53   <!-- **************************************************************
54        COMMENTS
55        ************************************************************** -->
56
57   <!-- any comments in the lines before function() are better than forcing
58        a PHPdoc style right now -->
59   <rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
60     <severity>0</severity>
61   </rule>
62
63   <!-- We allow comments after statements -->
64   <rule ref="Squiz.Commenting.PostStatementComment.Found">
65     <severity>0</severity>
66   </rule>
67   <!-- ... even without space e.g. //some words -->
68   <rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
69     <severity>0</severity>
70   </rule>
71   <!-- blank lines after inline comments are fine -->
72   <rule ref="Squiz.Commenting.InlineComment.SpacingAfter">
73     <severity>0</severity>
74   </rule>
75
76   <!-- Comments don't have to start uppercase -->
77   <rule ref="Squiz.Commenting.InlineComment.NotCapital">
78     <severity>0</severity>
79   </rule>
80   <!-- Comments don't have to end with one of .!? -->
81   <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
82     <severity>0</severity>
83   </rule>
84   <!-- Empty comments are fine -->
85   <rule ref="Squiz.Commenting.InlineComment.Empty">
86     <severity>0</severity>
87   </rule>
88
89
90
91
92   <!-- **************************************************************
93        INDENTATION, SPACING
94        ************************************************************** -->
95
96   <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
97
98   <!-- Aligned looks nicer, but causes too many warnings currently -->
99   <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
100     <severity>0</severity>
101   </rule>
102
103
104
105
106
107
108   <!-- **************************************************************
109        VARIABLES
110        ************************************************************** -->
111
112   <!-- CONST_this_var is fine, we don't need ConstThisVar -->
113   <rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
114     <severity>0</severity>
115   </rule>
116
117   <!-- simply disagree with "Each line in an array declaration must end in a comma" -->
118   <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
119     <severity>0</severity>
120   </rule>
121   <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
122     <severity>0</severity>
123   </rule>
124
125   <!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
126   <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
127     <severity>0</severity>
128   </rule>
129
130   <!-- array() instead of [] for initialisation -->
131   <rule ref="Generic.Arrays.DisallowShortArraySyntax.Found" />
132
133
134
135
136   <!-- **************************************************************
137        STRING QUOTING
138        ************************************************************** -->
139
140   <!-- Prefer single quoted strings -->
141   <rule ref="Squiz.Strings.DoubleQuoteUsage" />
142
143   <!-- We allow variabled inside double-quoted strings "abc $somevar" -->
144   <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
145     <severity>0</severity>
146   </rule>
147
148
149
150
151
152   <!-- **************************************************************
153        CONTROL STRUCTURES
154        ************************************************************** -->
155
156   <!-- we allow "if (a) echo 'b'" without brackets -->
157   <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
158     <severity>0</severity>
159   </rule>
160
161   <!-- We allow "if (a)". No need for "if (a === TRUE)" -->
162   <rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
163     <severity>0</severity>
164   </rule>
165   <!-- ... same for "if (!a)" -->
166   <rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
167     <severity>0</severity>
168   </rule>
169
170
171
172 </ruleset>