ruleset.xml 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <ruleset name="PPW Coding Standard">
  3. <description>This is the coding standard used for the Emogrifier code.
  4. This standard has been tested with to work with PHP_CodeSniffer >= 2.3.0.
  5. </description>
  6. <!--The complete PSR-2 ruleset-->
  7. <rule ref="PSR2"/>
  8. <!-- Arrays -->
  9. <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
  10. <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
  11. <!-- Classes -->
  12. <rule ref="Generic.Classes.DuplicateClassName"/>
  13. <rule ref="Squiz.Classes.ClassFileName"/>
  14. <rule ref="Squiz.Classes.DuplicateProperty"/>
  15. <rule ref="Squiz.Classes.LowercaseClassKeywords"/>
  16. <rule ref="Squiz.Classes.SelfMemberReference"/>
  17. <!-- Code analysis -->
  18. <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
  19. <rule ref="Generic.CodeAnalysis.ForLoopShouldBeWhileLoop"/>
  20. <rule ref="Generic.CodeAnalysis.ForLoopWithTestFunctionCall"/>
  21. <rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
  22. <rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
  23. <rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
  24. <rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
  25. <rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
  26. <!-- Commenting -->
  27. <rule ref="Generic.Commenting.Fixme"/>
  28. <rule ref="Generic.Commenting.Todo"/>
  29. <rule ref="PEAR.Commenting.InlineComment"/>
  30. <rule ref="Squiz.Commenting.DocCommentAlignment"/>
  31. <rule ref="Squiz.Commenting.EmptyCatchComment"/>
  32. <rule ref="Squiz.Commenting.FunctionCommentThrowTag"/>
  33. <rule ref="Squiz.Commenting.PostStatementComment"/>
  34. <rule ref="TYPO3SniffPool.Commenting.ClassComment"/>
  35. <rule ref="TYPO3SniffPool.Commenting.DoubleSlashCommentsInNewLine"/>
  36. <rule ref="TYPO3SniffPool.Commenting.SpaceAfterDoubleSlash"/>
  37. <!-- Control structures -->
  38. <rule ref="PEAR.ControlStructures.ControlSignature"/>
  39. <rule ref="TYPO3SniffPool.ControlStructures.DisallowEachInLoopCondition"/>
  40. <rule ref="TYPO3SniffPool.ControlStructures.DisallowElseIfConstruct"/>
  41. <rule ref="TYPO3SniffPool.ControlStructures.ExtraBracesByAssignmentInLoop"/>
  42. <rule ref="TYPO3SniffPool.ControlStructures.SwitchDeclaration"/>
  43. <rule ref="TYPO3SniffPool.ControlStructures.TernaryConditionalOperator"/>
  44. <rule ref="TYPO3SniffPool.ControlStructures.UnusedVariableInForEachLoop"/>
  45. <!-- Debug -->
  46. <rule ref="Generic.Debug.ClosureLinter"/>
  47. <rule ref="TYPO3SniffPool.Debug.DebugCode"/>
  48. <!-- Files -->
  49. <rule ref="Generic.Files.OneClassPerFile"/>
  50. <rule ref="Generic.Files.OneInterfacePerFile"/>
  51. <rule ref="TYPO3SniffPool.Files.FileExtension"/>
  52. <rule ref="TYPO3SniffPool.Files.Filename"/>
  53. <rule ref="TYPO3SniffPool.Files.IncludingFile"/>
  54. <rule ref="Zend.Files.ClosingTag"/>
  55. <!-- Formatting -->
  56. <rule ref="Generic.Formatting.SpaceAfterCast"/>
  57. <rule ref="PEAR.Formatting.MultiLineAssignment"/>
  58. <!-- Functions -->
  59. <rule ref="Generic.Functions.CallTimePassByReference"/>
  60. <rule ref="Squiz.Functions.FunctionDuplicateArgument"/>
  61. <rule ref="Squiz.Functions.GlobalFunction"/>
  62. <!-- Metrics -->
  63. <!-- Enable this rule when the cyclomatic complexity of all methods is sufficiently low. -->
  64. <!--<rule ref="Generic.Metrics.CyclomaticComplexity"/>-->
  65. <rule ref="Generic.Metrics.NestingLevel"/>
  66. <!-- Naming conventions -->
  67. <rule ref="Generic.NamingConventions.ConstructorName"/>
  68. <rule ref="PEAR.NamingConventions.ValidClassName"/>
  69. <rule ref="TYPO3SniffPool.NamingConventions.ValidFunctionName"/>
  70. <rule ref="TYPO3SniffPool.NamingConventions.ValidVariableName"/>
  71. <!-- Objects -->
  72. <rule ref="Squiz.Objects.ObjectMemberComma"/>
  73. <!-- Operators -->
  74. <rule ref="Squiz.Operators.IncrementDecrementUsage"/>
  75. <rule ref="Squiz.Operators.ValidLogicalOperators"/>
  76. <!-- PHP -->
  77. <rule ref="Generic.PHP.CharacterBeforePHPOpeningTag"/>
  78. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  79. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  80. <rule ref="Generic.PHP.ForbiddenFunctions"/>
  81. <rule ref="Generic.PHP.NoSilencedErrors"/>
  82. <rule ref="Squiz.PHP.CommentedOutCode">
  83. <properties>
  84. <property name="maxPercentage" value="70"/>
  85. </properties>
  86. </rule>
  87. <rule ref="Squiz.PHP.DisallowMultipleAssignments"/>
  88. <rule ref="Squiz.PHP.DisallowSizeFunctionsInLoops"/>
  89. <rule ref="Squiz.PHP.DiscouragedFunctions"/>
  90. <rule ref="Squiz.PHP.Eval"/>
  91. <rule ref="Squiz.PHP.ForbiddenFunctions"/>
  92. <rule ref="Squiz.PHP.GlobalKeyword"/>
  93. <rule ref="Squiz.PHP.Heredoc"/>
  94. <rule ref="Squiz.PHP.InnerFunctions"/>
  95. <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
  96. <rule ref="Squiz.PHP.NonExecutableCode"/>
  97. <!-- Scope -->
  98. <rule ref="Squiz.Scope.MemberVarScope"/>
  99. <rule ref="Squiz.Scope.StaticThisUsage"/>
  100. <rule ref="TYPO3SniffPool.Scope.AlwaysReturn">
  101. <exclude-pattern>*/Tests/*</exclude-pattern>
  102. </rule>
  103. <!--Strings-->
  104. <rule ref="Squiz.Strings.DoubleQuoteUsage"/>
  105. <rule ref="TYPO3SniffPool.Strings.ConcatenationSpacing"/>
  106. <rule ref="TYPO3SniffPool.Strings.UnnecessaryStringConcat"/>
  107. <!-- Whitespace -->
  108. <rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
  109. <rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
  110. <rule ref="Squiz.WhiteSpace.CastSpacing"/>
  111. <rule ref="Squiz.WhiteSpace.LogicalOperatorSpacing"/>
  112. <rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
  113. <rule ref="Squiz.WhiteSpace.PropertyLabelSpacing"/>
  114. <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
  115. <rule ref="TYPO3SniffPool.WhiteSpace.NoWhitespaceAtInDecrement"/>
  116. <rule ref="TYPO3SniffPool.WhiteSpace.ScopeClosingBrace"/>
  117. <rule ref="TYPO3SniffPool.WhiteSpace.WhitespaceAfterCommentSigns"/>
  118. </ruleset>