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 <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>
17 <rule ref="Generic.Files.LineLength">
19 <property name="lineLimit" value="194"/>
20 <property name="absoluteLineLimit" value="194"/>
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.
29 <rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
30 <severity>0</severity>
35 <!-- **************************************************************
37 ************************************************************** -->
39 <rule ref="PEAR.Commenting.FunctionComment.Missing">
40 <severity>0</severity>
46 <!-- **************************************************************
48 ************************************************************** -->
50 <!-- any comments in the lines before function() are better than forcing
51 a PHPdoc style right now -->
52 <rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
53 <severity>0</severity>
56 <!-- We allow comments after statements -->
57 <rule ref="Squiz.Commenting.PostStatementComment.Found">
58 <severity>0</severity>
60 <!-- ... even without space e.g. //some words -->
61 <rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
62 <severity>0</severity>
64 <!-- blank lines after inline comments are fine -->
65 <rule ref="Squiz.Commenting.InlineComment.SpacingAfter">
66 <severity>0</severity>
69 <!-- Comments don't have to start uppercase -->
70 <rule ref="Squiz.Commenting.InlineComment.NotCapital">
71 <severity>0</severity>
73 <!-- Comments don't have to end with one of .!? -->
74 <rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
75 <severity>0</severity>
77 <!-- Empty comments are fine -->
78 <rule ref="Squiz.Commenting.InlineComment.Empty">
79 <severity>0</severity>
85 <!-- **************************************************************
87 ************************************************************** -->
89 <!-- We don't need 2 blank lines after function -->
90 <rule ref="Squiz.WhiteSpace.FunctionSpacing.After">
91 <severity>0</severity>
94 <!-- Aligned looks nicer, but causes too many warnings currently -->
95 <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSame">
96 <severity>0</severity>
98 <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
99 <severity>0</severity>
102 <!-- Aligned looks nicer, but causes too many warnings currently -->
103 <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
104 <severity>0</severity>
113 <!-- **************************************************************
115 ************************************************************** -->
117 <!-- CONST_this_var is fine, we don't need ConstThisVar -->
118 <rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
119 <severity>0</severity>
122 <!-- simply disagree with "Each line in an array declaration must end in a comma" -->
123 <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
124 <severity>0</severity>
126 <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
127 <severity>0</severity>
130 <!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
131 <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
132 <severity>0</severity>
139 <!-- **************************************************************
141 ************************************************************** -->
143 <!-- Prefer single quoted strings -->
144 <rule ref="Squiz.Strings.DoubleQuoteUsage" />
146 <!-- We allow variabled inside double-quoted strings "abc $somevar" -->
147 <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
148 <severity>0</severity>
155 <!-- **************************************************************
157 ************************************************************** -->
159 <!-- we allow "if (a) echo 'b'" without brackets -->
160 <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
161 <severity>0</severity>
164 <!-- We allow "if (a)". No need for "if (a === TRUE)" -->
165 <rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
166 <severity>0</severity>
168 <!-- ... same for "if (!a)" -->
169 <rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
170 <severity>0</severity>