phpcs.xml 4.7 KB

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