]> git.openstreetmap.org Git - nominatim.git/blobdiff - phpcs.xml
Merge pull request #2502 from lonvia/improve-development-documentation
[nominatim.git] / phpcs.xml
index c8b8a80e55d1d88e775aaedb28e6b5b54d338832..ab9d3969284b0961f0b4f31c9d4243de05556e5d 100644 (file)
--- a/phpcs.xml
+++ b/phpcs.xml
@@ -8,14 +8,16 @@
   <!-- https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Standards/PSR2/ruleset.xml -->
   <rule ref="PSR2"/>
 
+  <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>
 
-
-
-  <!-- currently 300 warnings, we set a limit later -->
   <rule ref="Generic.Files.LineLength">
     <properties>
-     <property name="lineLimit" value="9999"/>
-     <property name="absoluteLineLimit" value="0"/>
+     <property name="lineLimit" value="194"/>
+     <property name="absoluteLineLimit" value="194"/>
     </properties>
   </rule>
 
 
 
 
+  <!-- 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>
+
   <!-- **************************************************************
        DOCUMENTATION
        ************************************************************** -->
        INDENTATION, SPACING
        ************************************************************** -->
 
-  <!-- We don't need 2 blank lines after function -->
-  <rule ref="Squiz.WhiteSpace.FunctionSpacing.After">
-    <severity>0</severity>
-  </rule>
-
-  <!-- Aligned looks nicer, but causes too many warnings currently -->
-  <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSame">
-    <severity>0</severity>
-  </rule>
-  <rule ref="Generic.Formatting.MultipleStatementAlignment.NotSameWarning">
-    <severity>0</severity>
-  </rule>
+  <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned" />
 
   <!-- Aligned looks nicer, but causes too many warnings currently -->
   <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
 
 
 
-
   <!-- **************************************************************
        VARIABLES
        ************************************************************** -->
     <severity>0</severity>
   </rule>
 
+  <!-- array() instead of [] for initialisation -->
+  <rule ref="Generic.Arrays.DisallowShortArraySyntax.Found" />
+
+
+
+
+  <!-- **************************************************************
+       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>
+
+