phpcs.xml 5.1 KB

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