2016-09-08 04:16:22 +03:00
|
|
|
<?xml version="1.0"?>
|
|
|
|
<ruleset name="Nominatim Standard">
|
|
|
|
|
|
|
|
<description>Nominatim coding standard</description>
|
|
|
|
|
|
|
|
<!-- based on another standard, you can find it here -->
|
|
|
|
<!-- /usr/share/php/PHP/CodeSniffer/Standards/PSR2/ruleset.xml -->
|
|
|
|
<!-- https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/PSR2/ruleset.xml -->
|
|
|
|
<rule ref="PSR2"/>
|
|
|
|
|
2018-02-23 03:15:36 +03:00
|
|
|
<exclude-pattern>./lib/template/*html*</exclude-pattern>
|
|
|
|
<exclude-pattern>./lib/template/includes/</exclude-pattern>
|
|
|
|
<exclude-pattern>./module/</exclude-pattern>
|
|
|
|
<exclude-pattern>./website/css</exclude-pattern>
|
|
|
|
<exclude-pattern>./website/js</exclude-pattern>
|
|
|
|
|
2016-09-08 04:16:22 +03:00
|
|
|
<rule ref="Generic.Files.LineLength">
|
|
|
|
<properties>
|
2017-10-08 18:00:59 +03:00
|
|
|
<property name="lineLimit" value="194"/>
|
|
|
|
<property name="absoluteLineLimit" value="194"/>
|
2016-09-08 04:16:22 +03:00
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
2016-09-14 04:23:43 +03:00
|
|
|
<!-- "A file should declare new symbols (classes, functions, constants, etc.) and cause no
|
|
|
|
other side effects, or it should execute logic with side effects, but should not do both."
|
|
|
|
... we have too many script and includes to be able to enforce that.
|
|
|
|
-->
|
|
|
|
<rule ref="PSR1.Files.SideEffects.FoundWithSymbols">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
2016-09-08 04:16:22 +03:00
|
|
|
|
2018-03-22 14:36:24 +03:00
|
|
|
<!-- eval, system, etc -->
|
|
|
|
<rule ref="Generic.PHP.ForbiddenFunctions">
|
|
|
|
<properties>
|
|
|
|
<property name="forbiddenFunctions" type="array" value="sizeof=>count,delete=>unset,print=>echo,create_function=>null,eval=>null"/>
|
|
|
|
</properties>
|
|
|
|
</rule>
|
|
|
|
|
2016-09-08 04:16:22 +03:00
|
|
|
<!-- **************************************************************
|
|
|
|
DOCUMENTATION
|
|
|
|
************************************************************** -->
|
|
|
|
|
|
|
|
<rule ref="PEAR.Commenting.FunctionComment.Missing">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- **************************************************************
|
|
|
|
COMMENTS
|
|
|
|
************************************************************** -->
|
|
|
|
|
2016-09-14 04:23:43 +03:00
|
|
|
<!-- any comments in the lines before function() are better than forcing
|
|
|
|
a PHPdoc style right now -->
|
|
|
|
<rule ref="PEAR.Commenting.FunctionComment.WrongStyle">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
2016-09-08 04:16:22 +03:00
|
|
|
<!-- We allow comments after statements -->
|
|
|
|
<rule ref="Squiz.Commenting.PostStatementComment.Found">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
<!-- ... even without space e.g. //some words -->
|
|
|
|
<rule ref="Squiz.Commenting.InlineComment.NoSpaceBefore">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
2016-09-14 04:23:43 +03:00
|
|
|
<!-- blank lines after inline comments are fine -->
|
|
|
|
<rule ref="Squiz.Commenting.InlineComment.SpacingAfter">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
2016-09-08 04:16:22 +03:00
|
|
|
|
|
|
|
<!-- Comments don't have to start uppercase -->
|
|
|
|
<rule ref="Squiz.Commenting.InlineComment.NotCapital">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
<!-- Comments don't have to end with one of .!? -->
|
|
|
|
<rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
2016-09-14 04:23:43 +03:00
|
|
|
<!-- Empty comments are fine -->
|
|
|
|
<rule ref="Squiz.Commenting.InlineComment.Empty">
|
2016-09-08 04:16:22 +03:00
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- **************************************************************
|
|
|
|
INDENTATION, SPACING
|
|
|
|
************************************************************** -->
|
|
|
|
|
|
|
|
<!-- Aligned looks nicer, but causes too many warnings currently -->
|
|
|
|
<rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- **************************************************************
|
|
|
|
VARIABLES
|
|
|
|
************************************************************** -->
|
|
|
|
|
|
|
|
<!-- CONST_this_var is fine, we don't need ConstThisVar -->
|
|
|
|
<rule ref="Generic.NamingConventions.UpperCaseConstantName.ConstantNotUpperCase">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<!-- simply disagree with "Each line in an array declaration must end in a comma" -->
|
|
|
|
<rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
<rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<!-- We allow "$abc = array($aPoint[1], $aPoint[2])" -->
|
|
|
|
<rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-10-21 15:52:58 +03:00
|
|
|
|
|
|
|
<!-- **************************************************************
|
|
|
|
STRING QUOTING
|
|
|
|
************************************************************** -->
|
|
|
|
|
|
|
|
<!-- Prefer single quoted strings -->
|
|
|
|
<rule ref="Squiz.Strings.DoubleQuoteUsage" />
|
|
|
|
|
|
|
|
<!-- We allow variabled inside double-quoted strings "abc $somevar" -->
|
|
|
|
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-08 04:16:22 +03:00
|
|
|
<!-- **************************************************************
|
|
|
|
CONTROL STRUCTURES
|
|
|
|
************************************************************** -->
|
|
|
|
|
|
|
|
<!-- we allow "if (a) echo 'b'" without brackets -->
|
|
|
|
<rule ref="Generic.ControlStructures.InlineControlStructure.NotAllowed">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
<!-- We allow "if (a)". No need for "if (a === TRUE)" -->
|
|
|
|
<rule ref="Squiz.Operators.ComparisonOperatorUsage.ImplicitTrue">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
<!-- ... same for "if (!a)" -->
|
|
|
|
<rule ref="Squiz.Operators.ComparisonOperatorUsage.NotAllowed">
|
|
|
|
<severity>0</severity>
|
|
|
|
</rule>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</ruleset>
|