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 <!-- Aligned looks nicer, but causes too many warnings currently -->
90 <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
91 <severity>0</severity>
100 <!-- **************************************************************
102 ************************************************************** -->
104 <!-- CONST_this_var is fine, we don't need ConstThisVar -->
105 <rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
106 <severity>0</severity>
109 <!-- simply disagree with "Each line in an array declaration must end in a comma" -->
110 <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
111 <severity>0</severity>
113 <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
114 <severity>0</severity>
117 <!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
118 <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
119 <severity>0</severity>
126 <!-- **************************************************************
128 ************************************************************** -->
130 <!-- Prefer single quoted strings -->
131 <rule ref="Squiz.Strings.DoubleQuoteUsage" />
133 <!-- We allow variabled inside double-quoted strings "abc $somevar" -->
134 <rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
135 <severity>0</severity>
142 <!-- **************************************************************
144 ************************************************************** -->
146 <!-- we allow "if (a) echo 'b'" without brackets -->
147 <rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
148 <severity>0</severity>
151 <!-- We allow "if (a)". No need for "if (a === TRUE)" -->
152 <rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
153 <severity>0</severity>
155 <!-- ... same for "if (!a)" -->
156 <rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
157 <severity>0</severity>