Drupal investigation

phpcs.xml.dist 6.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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="Drupal.Classes.ClassCreateInstance"/>
  13. <rule ref="Drupal.Classes.ClassDeclaration"/>
  14. <rule ref="Drupal.Classes.FullyQualifiedNamespace"/>
  15. <rule ref="Drupal.Classes.UnusedUseStatement"/>
  16. <rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
  17. <rule ref="Drupal.CSS.ColourDefinition"/>
  18. <rule ref="Drupal.Commenting.ClassComment">
  19. <exclude name="Drupal.Commenting.ClassComment.Missing"/>
  20. </rule>
  21. <rule ref="Drupal.Commenting.DocComment">
  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="Drupal.Commenting.DocCommentStar"/>
  42. <rule ref="Drupal.Commenting.FileComment"/>
  43. <rule ref="Drupal.Commenting.FunctionComment">
  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="Drupal.ControlStructures.ElseIf"/>
  66. <rule ref="Drupal.ControlStructures.ControlSignature"/>
  67. <rule ref="Drupal.Files.EndFileNewline"/>
  68. <rule ref="Drupal.Files.TxtFileLineLength"/>
  69. <rule ref="Drupal.Formatting.SpaceInlineIf"/>
  70. <rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
  71. <rule ref="Drupal.Functions.DiscouragedFunctions"/>
  72. <rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter"/>
  73. <rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis"/>
  74. <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
  75. <rule ref="Drupal.InfoFiles.ClassFiles"/>
  76. <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
  77. <rule ref="Drupal.InfoFiles.Required"/>
  78. <rule ref="Drupal.Scope.MethodScope"/>
  79. <rule ref="Drupal.Semantics.EmptyInstall"/>
  80. <rule ref="Drupal.Semantics.FunctionT">
  81. <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
  82. <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
  83. <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
  84. </rule>
  85. <rule ref="Drupal.Semantics.FunctionWatchdog"/>
  86. <rule ref="Drupal.Semantics.InstallHooks"/>
  87. <rule ref="Drupal.Semantics.LStringTranslatable"/>
  88. <rule ref="Drupal.Semantics.PregSecurity"/>
  89. <rule ref="Drupal.Semantics.TInHookMenu"/>
  90. <rule ref="Drupal.Semantics.TInHookSchema"/>
  91. <rule ref="Drupal.WhiteSpace.Comma"/>
  92. <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
  93. <rule ref="Drupal.WhiteSpace.ObjectOperatorSpacing"/>
  94. <rule ref="Drupal.WhiteSpace.OpenTagNewline"/>
  95. <rule ref="Drupal.WhiteSpace.OperatorSpacing"/>
  96. <rule ref="Drupal.WhiteSpace.ScopeIndent"/>
  97. <!-- Drupal Practice sniffs -->
  98. <rule ref="DrupalPractice.Commenting.ExpectedException"/>
  99. <!-- Generic sniffs -->
  100. <rule ref="Generic.Files.LineEndings"/>
  101. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  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>