phpcs.xml 5.3 KB

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