phpcs.xml 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. <arg name="extensions" value="php,phtml,css,js"/>
  5. <arg name="tab-width" value="4"/>
  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. <exclude-pattern>./node_modules/</exclude-pattern>
  11. <exclude-pattern>./data/config.php</exclude-pattern>
  12. <exclude-pattern>./data/users/*/config.php</exclude-pattern>
  13. <exclude-pattern>./extensions/</exclude-pattern>
  14. <exclude-pattern>*.min.js$</exclude-pattern>
  15. <!-- Duplicate class names are not allowed -->
  16. <rule ref="Generic.Classes.DuplicateClassName"/>
  17. <!-- Statements must not be empty -->
  18. <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
  19. <!-- Unconditional if-statements are not allowed -->
  20. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  21. <!-- Do not use final statements inside final classes -->
  22. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  23. <!-- Do not override methods to call their parent -->
  24. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  25. <!-- Maximum line length -->
  26. <rule ref="Generic.Files.LineLength">
  27. <!-- For language strings maximum line lengths make little sense. -->
  28. <exclude-pattern>./app/i18n/</exclude-pattern>
  29. <!-- Don't enforce line length on the HTML; the point is to improve legibility, not reduce it -->
  30. <exclude-pattern>*.phtml$</exclude-pattern>
  31. <properties>
  32. <property name="lineLimit" value="165"/>
  33. <property name="absoluteLineLimit" value="190"/>
  34. </properties>
  35. </rule>
  36. <!-- When calling a function: -->
  37. <!-- Do not add a space before the opening parenthesis -->
  38. <!-- Do not add a space after the opening parenthesis -->
  39. <!-- Do not add a space before the closing parenthesis -->
  40. <!-- Do not add a space before a comma -->
  41. <!-- Add a space after a comma -->
  42. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  43. <rule ref="Generic.PHP.DisallowShortOpenTag">
  44. <exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
  45. </rule>
  46. <rule ref="Generic.PHP.DeprecatedFunctions" />
  47. <!-- Use UPPERCARE for constants -->
  48. <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  49. <!-- Use lowercase for 'true', 'false' and 'null' -->
  50. <rule ref="Generic.PHP.LowerCaseConstant"/>
  51. <!-- Use a single string instead of concatenating -->
  52. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  53. <properties>
  54. <!-- Allow string concatenating across multiple lines -->
  55. <property name="allowMultiline" value="true"/>
  56. </properties>
  57. </rule>
  58. <!-- Use tabs for indentation -->
  59. <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
  60. <!-- Parameters with default values must appear last in functions -->
  61. <rule ref="PEAR.Functions.ValidDefaultValue"/>
  62. <!-- Use 'elseif' instead of 'else if' -->
  63. <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
  64. <!-- Do not add spaces after opening or before closing bracket -->
  65. <rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
  66. <!-- Add a new line at the end of a file -->
  67. <rule ref="PSR2.Files.EndFileNewline"/>
  68. <!-- Use Unix newlines -->
  69. <rule ref="Generic.Files.LineEndings">
  70. <properties>
  71. <property name="eolChar" value="\n" />
  72. </properties>
  73. </rule>
  74. <!-- Add space after closing parenthesis -->
  75. <!-- Add body into new line -->
  76. <!-- Close body in new line -->
  77. <rule ref="Squiz.ControlStructures.ControlSignature">
  78. <!-- No space after keyword (before opening parenthesis) -->
  79. <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/>
  80. </rule>
  81. <!-- When declaring a function: -->
  82. <!-- Do not add a space before a comma -->
  83. <!-- Add a space after a comma -->
  84. <!-- Add a space before and after an equal sign -->
  85. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
  86. <properties>
  87. <property name="equalsSpacing" value="1"/>
  88. </properties>
  89. </rule>
  90. <!-- Do not add spaces when casting -->
  91. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  92. <!-- Operators must have a space around them -->
  93. <rule ref="Squiz.WhiteSpace.OperatorSpacing">
  94. <properties>
  95. <property name="ignoreNewlines" value="true" />
  96. </properties>
  97. </rule>
  98. <!-- Do not add a whitespace before a semicolon -->
  99. <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  100. <!-- Do not add whitespace at start or end of a file or end of a line -->
  101. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
  102. <!-- Expected space after closing parenthesis -->
  103. <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis">
  104. <exclude-pattern>.phtml$</exclude-pattern>
  105. </rule>
  106. <!-- Newline required after opening brace -->
  107. <rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
  108. <exclude-pattern>.phtml$</exclude-pattern>
  109. <exclude-pattern>.js$</exclude-pattern>
  110. </rule>
  111. <!-- No PHP code was found in this file -->
  112. <rule ref="Internal.NoCodeFound">
  113. <exclude-pattern>.phtml$</exclude-pattern>
  114. </rule>
  115. </ruleset>