phpcs.xml 5.4 KB

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