phpcs.xml 4.5 KB

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