phpcs.xml 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. <!-- to circumvent https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 -->
  5. <arg name="tab-width" value="40"/>
  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. <!-- Duplicate class names are not allowed -->
  11. <rule ref="Generic.Classes.DuplicateClassName"/>
  12. <!-- Statements must not be empty -->
  13. <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
  14. <!-- Unconditional if-statements are not allowed -->
  15. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  16. <!-- Do not use final statements inside final classes -->
  17. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  18. <!-- Do not override methods to call their parent -->
  19. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  20. <!-- One line should not have more than 80 characters -->
  21. <!-- One line must never exceed 120 characters -->
  22. <rule ref="Generic.Files.LineLength">
  23. <!-- For language strings maximum line lengths make little sense. -->
  24. <exclude-pattern>./app/i18n/</exclude-pattern>
  25. <!-- Don't enforce line length on the HTML; the point is to improve legibility, not reduce it -->
  26. <exclude-pattern>./app/install.php</exclude-pattern>
  27. <!-- @todo remove test exclusion -->
  28. <exclude-pattern>./tests/app/</exclude-pattern>
  29. <properties>
  30. <property name="lineLimit" value="100"/>
  31. <!-- needs to be large to accomodate extra large tab width to circumvent https://github.com/squizlabs/PHP_CodeSniffer/pull/1404 -->
  32. <property name="absoluteLineLimit" value="500"/>
  33. </properties>
  34. </rule>
  35. <!-- When calling a function: -->
  36. <!-- Do not add a space before the opening parenthesis -->
  37. <!-- Do not add a space after the opening parenthesis -->
  38. <!-- Do not add a space before the closing parenthesis -->
  39. <!-- Do not add a space before a comma -->
  40. <!-- Add a space after a comma -->
  41. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  42. <rule ref="Generic.PHP.DisallowShortOpenTag" />
  43. <rule ref="Generic.PHP.DeprecatedFunctions" />
  44. <!-- Use UPPERCARE for constants -->
  45. <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  46. <!-- Use lowercase for 'true', 'false' and 'null' -->
  47. <rule ref="Generic.PHP.LowerCaseConstant"/>
  48. <!-- Use a single string instead of concatenating -->
  49. <rule ref="Generic.Strings.UnnecessaryStringConcat">
  50. <properties>
  51. <!-- Allow string concatenating across multiple lines -->
  52. <property name="allowMultiline" value="true"/>
  53. </properties>
  54. </rule>
  55. <!-- Use tabs for indentation -->
  56. <rule ref="Generic.WhiteSpace.DisallowSpaceIndent"/>
  57. <!-- Parameters with default values must appear last in functions -->
  58. <rule ref="PEAR.Functions.ValidDefaultValue"/>
  59. <!-- Use 'elseif' instead of 'else if' -->
  60. <rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
  61. <!-- Do not add spaces after opening or before closing bracket -->
  62. <rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
  63. <!-- Add a new line at the end of a file -->
  64. <rule ref="PSR2.Files.EndFileNewline"/>
  65. <!-- Use Unix newlines -->
  66. <rule ref="Generic.Files.LineEndings">
  67. <properties>
  68. <property name="eolChar" value="\n" />
  69. </properties>
  70. </rule>
  71. <!-- Add space after closing parenthesis -->
  72. <!-- Add body into new line -->
  73. <!-- Close body in new line -->
  74. <rule ref="Squiz.ControlStructures.ControlSignature">
  75. <!-- No space after keyword (before opening parenthesis) -->
  76. <exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword"/>
  77. </rule>
  78. <!-- When declaring a function: -->
  79. <!-- Do not add a space before a comma -->
  80. <!-- Add a space after a comma -->
  81. <!-- Add a space before and after an equal sign -->
  82. <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
  83. <properties>
  84. <property name="equalsSpacing" value="1"/>
  85. </properties>
  86. </rule>
  87. <!-- Do not add spaces when casting -->
  88. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  89. <!-- Operators must have a space around them -->
  90. <rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
  91. <!-- Do not add a whitespace before a semicolon -->
  92. <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  93. <!-- Do not add whitespace at start or end of a file or end of a line -->
  94. <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
  95. </ruleset>