phpcs.xml 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <ruleset name="drupal_core">
  3. <description>PHP CodeSniffer configuration</description>
  4. <file>.</file>
  5. <arg name="extensions" value="install,module,php"/>
  6. <!--Exclude third party code.-->
  7. <exclude-pattern>./vendor/*</exclude-pattern>
  8. <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
  9. <!-- Drupal sniffs -->
  10. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassCreateInstanceSniff.php"/>
  11. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php"/>
  12. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/FullyQualifiedNamespaceSniff.php"/>
  13. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UnusedUseStatementSniff.php"/>
  14. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UseLeadingBackslashSniff.php"/>
  15. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php"/>
  16. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php"/>
  17. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php">
  18. <exclude name="Drupal.Commenting.ClassComment.Missing"/>
  19. </rule>
  20. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php">
  21. <!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween,
  22. ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace,
  23. SpacingAfter -->
  24. <exclude name="Drupal.Commenting.DocComment.LongNotCapital"/>
  25. <!-- ParamNotFirst still not decided for PHPUnit-based tests.
  26. @see https://www.drupal.org/node/2253915 -->
  27. <exclude name="Drupal.Commenting.DocComment.ParamNotFirst"/>
  28. <exclude name="Drupal.Commenting.DocComment.SpacingBeforeTags"/>
  29. <exclude name="Drupal.Commenting.DocComment.LongFullStop"/>
  30. <exclude name="Drupal.Commenting.DocComment.ShortNotCapital"/>
  31. <exclude name="Drupal.Commenting.DocComment.ShortFullStop"/>
  32. <!-- TagsNotGrouped and ParamGroup have false-positives.
  33. @see https://www.drupal.org/node/2060925 -->
  34. <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
  35. <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
  36. <exclude name="Drupal.Commenting.DocComment.ShortSingleLine"/>
  37. <exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/>
  38. <exclude name="Drupal.Commenting.DocComment.MissingShort"/>
  39. </rule>
  40. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentStarSniff.php"/>
  41. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php"/>
  42. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php">
  43. <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
  44. <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
  45. <exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/>
  46. <exclude name="Drupal.Commenting.FunctionComment.InvalidTypeHint"/>
  47. <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
  48. <exclude name="Drupal.Commenting.FunctionComment.MissingFile"/>
  49. <exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
  50. <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
  51. <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
  52. <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/>
  53. <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/>
  54. <exclude name="Drupal.Commenting.FunctionComment.ParamCommentIndentation"/>
  55. <exclude name="Drupal.Commenting.FunctionComment.ParamMissingDefinition"/>
  56. <exclude name="Drupal.Commenting.FunctionComment.ParamNameNoMatch"/>
  57. <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
  58. </rule>
  59. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ElseIfSniff.php"/>
  60. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ControlSignatureSniff.php"/>
  61. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/EndFileNewlineSniff.php"/>
  62. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/TxtFileLineLengthSniff.php"/>
  63. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php"/>
  64. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceInlineIfSniff.php"/>
  65. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceUnaryOperatorSniff.php"/>
  66. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php"/>
  67. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/FunctionDeclarationSniff.php"/>
  68. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/AutoAddedKeysSniff.php"/>
  69. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php"/>
  70. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php"/>
  71. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/RequiredSniff.php"/>
  72. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidVariableNameSniff.php">
  73. <!-- Sniff for: LowerStart -->
  74. <exclude name="Drupal.NamingConventions.ValidVariableName.LowerCamelName"/>
  75. </rule>
  76. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php"/>
  77. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/EmptyInstallSniff.php"/>
  78. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php">
  79. <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
  80. <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
  81. <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
  82. </rule>
  83. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionWatchdogSniff.php"/>
  84. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/InstallHooksSniff.php"/>
  85. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/LStringTranslatableSniff.php"/>
  86. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/PregSecuritySniff.php"/>
  87. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookMenuSniff.php"/>
  88. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookSchemaSniff.php"/>
  89. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/CommaSniff.php"/>
  90. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/EmptyLinesSniff.php"/>
  91. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php"/>
  92. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php"/>
  93. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php"/>
  94. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OperatorSpacingSniff.php"/>
  95. <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php"/>
  96. <!-- Drupal Practice sniffs -->
  97. <rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php"/>
  98. <!-- Generic sniffs -->
  99. <rule ref="Generic.Files.LineEndings"/>
  100. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  101. <rule ref="Generic.NamingConventions.ConstructorName" />
  102. <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  103. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  104. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  105. <rule ref="Generic.PHP.UpperCaseConstant"/>
  106. <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
  107. <rule ref="Generic.Arrays.DisallowLongArraySyntax" />
  108. <!-- PSR-2 sniffs -->
  109. <rule ref="PSR2.Classes.PropertyDeclaration">
  110. <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
  111. </rule>
  112. <!-- Squiz sniffs -->
  113. <rule ref="Squiz.Strings.ConcatenationSpacing">
  114. <properties>
  115. <property name="spacing" value="1"/>
  116. <property name="ignoreNewlines" value="true"/>
  117. </properties>
  118. </rule>
  119. </ruleset>