phpcs.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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>./vendor/</exclude-pattern>
  16. <exclude-pattern>*.min.js$</exclude-pattern>
  17. <!-- Duplicate class names are not allowed -->
  18. <rule ref="Generic.Classes.DuplicateClassName"/>
  19. <!-- Statements must not be empty -->
  20. <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
  21. <!-- Unconditional if-statements are not allowed -->
  22. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  23. <!-- Do not use final statements inside final classes -->
  24. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  25. <!-- Do not override methods to call their parent -->
  26. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  27. <!-- Maximum line length -->
  28. <rule ref="Generic.Files.LineLength">
  29. <!-- For language strings maximum line lengths make little sense. -->
  30. <exclude-pattern>./app/i18n/</exclude-pattern>
  31. <!-- Don't enforce line length on the HTML; the point is to improve legibility, not reduce it -->
  32. <exclude-pattern>*.phtml$</exclude-pattern>
  33. <properties>
  34. <property name="lineLimit" value="165"/>
  35. <property name="absoluteLineLimit" value="190"/>
  36. </properties>
  37. </rule>
  38. <!-- When calling a function: -->
  39. <!-- Do not add a space before the opening parenthesis -->
  40. <!-- Do not add a space after the opening parenthesis -->
  41. <!-- Do not add a space before the closing parenthesis -->
  42. <!-- Do not add a space before a comma -->
  43. <!-- Add a space after a comma -->
  44. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  45. <rule ref="Generic.PHP.DisallowShortOpenTag">
  46. <exclude name="Generic.PHP.DisallowShortOpenTag.EchoFound"/>
  47. </rule>
  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. <properties>
  97. <property name="ignoreNewlines" value="true" />
  98. </properties>
  99. </rule>
  100. <!-- Do not add a whitespace before a semicolon -->
  101. <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  102. <!-- Do not add whitespace at start or end of a file or end of a line -->
  103. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
  104. <!-- Expected space after closing parenthesis -->
  105. <rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis">
  106. <exclude-pattern>.phtml$</exclude-pattern>
  107. </rule>
  108. <!-- Newline required after opening brace -->
  109. <rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
  110. <exclude-pattern>.phtml$</exclude-pattern>
  111. <exclude-pattern>.js$</exclude-pattern>
  112. </rule>
  113. <!-- No PHP code was found in this file -->
  114. <rule ref="Internal.NoCodeFound">
  115. <exclude-pattern>.phtml$</exclude-pattern>
  116. </rule>
  117. </ruleset>