2 <ruleset name="Nominatim Standard">
4 <description>Nominatim coding standard</description>
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 -->
11 <rule ref="Generic.Files.LineLength">
13 <property name="lineLimit" value="194"/>
14 <property name="absoluteLineLimit" value="194"/>
19 <!-- "A file should declare new symbols (classes, functions, constants, etc.) and cause no
20 other side effects, or it should execute logic with side effects, but should not do both."
21 ... we have too many script and includes to be able to enforce that.
23 <rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
24 <severity>0</severity>
29 <!-- **************************************************************
31 ************************************************************** -->
33 <rule ref="PEAR.Commenting.FunctionComment.Missing">
34 <severity>0</severity>
40 <!-- **************************************************************
42 ************************************************************** -->
44 <!-- any comments in the lines before function() are better than forcing
45 a PHPdoc style right now -->
46 <rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
47 <severity>0</severity>
50 <!-- We allow comments after statements -->
51 <rule ref="Squiz.Commenting.PostStatementComment.Found">
52 <severity>0</severity>
54 <!-- ... even without space e.g. //some words -->
55 <rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
56 <severity>0</severity>
58 <!-- blank lines after inline comments are fine -->
59 <rule ref="Squiz.Commenting.InlineComment.SpacingAfter">
60 <severity>0</severity>
63 <!-- Comments don't have to start uppercase -->
64 <rule ref="Squiz.Commenting.InlineComment.NotCapital">
65 <severity>0</severity>
67 <!-- Comments don't have to end with one of .!? -->
68 <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
69 <severity>0</severity>
71 <!-- Empty comments are fine -->
72 <rule ref="Squiz.Commenting.InlineComment.Empty">
73 <severity>0</severity>
79 <!-- **************************************************************
81 ************************************************************** -->
83 <!-- We don't need 2 blank lines after function -->
84 <rule ref="Squiz.WhiteSpace.FunctionSpacing.After">
85 <severity>0</severity>
88 <!-- Aligned looks nicer, but causes too many warnings currently -->
89 <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSame">
90 <severity>0</severity>
92 <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
93 <severity>0</severity>
96 <!-- Aligned looks nicer, but causes too many warnings currently -->
97 <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
98 <severity>0</severity>
107 <!-- **************************************************************
109 ************************************************************** -->
111 <!-- CONST_this_var is fine, we don't need ConstThisVar -->
112 <rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
113 <severity>0</severity>
116 <!-- simply disagree with "Each line in an array declaration must end in a comma" -->
117 <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
118 <severity>0</severity>
120 <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
121 <severity>0</severity>
124 <!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
125 <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
126 <severity>0</severity>
133 <!-- **************************************************************
135 ************************************************************** -->
137 <!-- Prefer single quoted strings -->
138 <rule ref="Squiz.Strings.DoubleQuoteUsage" />
140 <!-- We allow variabled inside double-quoted strings "abc $somevar" -->
141 <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
142 <severity>0</severity>
149 <!-- **************************************************************
151 ************************************************************** -->
153 <!-- we allow "if (a) echo 'b'" without brackets -->
154 <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
155 <severity>0</severity>
158 <!-- We allow "if (a)". No need for "if (a === TRUE)" -->
159 <rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
160 <severity>0</severity>
162 <!-- ... same for "if (!a)" -->
163 <rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
164 <severity>0</severity>