phpcs.xml.dist 8.2 KB

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