phpcs.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <ruleset name="FreshRSS Ruleset">
  3. <description>Created with the PHP Coding Standard Generator. https://edorian.github.com/php-coding-standard-generator/</description>
  4. <!-- to circumvent https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 -->
  5. <arg name="tab-width" value="40"/>
  6. <exclude-pattern>./static</exclude-pattern>
  7. <exclude-pattern>./vendor</exclude-pattern>
  8. <exclude-pattern>./lib/SimplePie/</exclude-pattern>
  9. <exclude-pattern>./lib/http-conditional.php</exclude-pattern>
  10. <exclude-pattern>./lib/JSON.php</exclude-pattern>
  11. <exclude-pattern>./lib/lib_phpQuery.php</exclude-pattern>
  12. <exclude-pattern>./lib/password_compat.php</exclude-pattern>
  13. <!-- Duplicate class names are not allowed -->
  14. <rule ref="Generic.Classes.DuplicateClassName"/>
  15. <!-- Statements must not be empty -->
  16. <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
  17. <!-- Unconditional if-statements are not allowed -->
  18. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  19. <!-- Do not use final statements inside final classes -->
  20. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  21. <!-- Do not override methods to call their parent -->
  22. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  23. <!-- One line should not have more than 80 characters -->
  24. <!-- One line must never exceed 120 characters -->
  25. <rule ref="Generic.Files.LineLength">
  26. <!-- For language strings maximum line lengths make little sense. -->
  27. <exclude-pattern>./app/i18n/</exclude-pattern>
  28. <!-- Don't enforce line length on the HTML; the point is to improve legibility, not reduce it -->
  29. <exclude-pattern>./app/install.php</exclude-pattern>
  30. <!-- @todo remove test exclusion -->
  31. <exclude-pattern>./tests/app/</exclude-pattern>
  32. <!-- @todo remove SQL exclusion -->
  33. <exclude-pattern>./app/SQL/install.sql.mysql.php</exclude-pattern>
  34. <exclude-pattern>./app/SQL/install.sql.pgsql.php</exclude-pattern>
  35. <properties>
  36. <property name="lineLimit" value="100"/>
  37. <!-- needs to be large to accomodate extra large tab width to circumvent https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 -->
  38. <property name="absoluteLineLimit" value="500"/>
  39. </properties>
  40. </rule>
  41. <!-- When calling a function: -->
  42. <!-- Do not add a space before the opening parenthesis -->
  43. <!-- Do not add a space after the opening parenthesis -->
  44. <!-- Do not add a space before the closing parenthesis -->
  45. <!-- Do not add a space before a comma -->
  46. <!-- Add a space after a comma -->
  47. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  48. <rule ref="Generic.PHP.DisallowShortOpenTag" />
  49. <rule ref="Generic.PHP.DeprecatedFunctions" />
  50. <!-- Use UPPERCARE for constants -->
  51. <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  52. <!-- Use lowercase for 'true', 'false' and 'null' -->
  53. <rule ref="Generic.PHP.LowerCaseConstant"/>
  54. <!-- Use a single string instead of concatenating -->
  55. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  56. <properties>
  57. <!-- Allow string concatenating across multiple lines -->
  58. <property name="allowMultiline" value="true"/>
  59. </properties>
  60. </rule>
  61. <!-- Use tabs for indentation -->
  62. <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
  63. <!-- Parameters with default values must appear last in functions -->
  64. <rule ref="PEAR.Functions.ValidDefaultValue"/>
  65. <!-- Use 'elseif' instead of 'else if' -->
  66. <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
  67. <!-- Do not add spaces after opening or before closing bracket -->
  68. <rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
  69. <!-- Add a new line at the end of a file -->
  70. <rule ref="PSR2.Files.EndFileNewline"/>
  71. <!-- Use Unix newlines -->
  72. <rule ref="Generic.Files.LineEndings">
  73. <properties>
  74. <property name="eolChar" value="\n" />
  75. </properties>
  76. </rule>
  77. <!-- Add space after closing parenthesis -->
  78. <!-- Add body into new line -->
  79. <!-- Close body in new line -->
  80. <rule ref="Squiz.ControlStructures.ControlSignature">
  81. <!-- No space after keyword (before opening parenthesis) -->
  82. <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/>
  83. </rule>
  84. <!-- When declaring a function: -->
  85. <!-- Do not add a space before a comma -->
  86. <!-- Add a space after a comma -->
  87. <!-- Add a space before and after an equal sign -->
  88. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
  89. <properties>
  90. <property name="equalsSpacing" value="1"/>
  91. </properties>
  92. </rule>
  93. <!-- Do not add spaces when casting -->
  94. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  95. <!-- Operators must have a space around them -->
  96. <rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
  97. <!-- Do not add a whitespace before a semicolon -->
  98. <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  99. <!-- Do not add whitespace at start or end of a file or end of a line -->
  100. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
  101. </ruleset>