phpcs.xml.dist 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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.MissingParamName"/>
  52. <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
  53. <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
  54. <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/>
  55. <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/>
  56. <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNotCapital"/>
  57. <exclude name="Drupal.Commenting.FunctionComment.ParamNameNoMatch"/>
  58. <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
  59. </rule>
  60. <rule ref="Drupal.ControlStructures.ElseIf"/>
  61. <rule ref="Drupal.ControlStructures.ControlSignature"/>
  62. <rule ref="Drupal.Files.EndFileNewline"/>
  63. <rule ref="Drupal.Files.TxtFileLineLength"/>
  64. <rule ref="Drupal.Formatting.SpaceInlineIf"/>
  65. <rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
  66. <rule ref="Drupal.Functions.DiscouragedFunctions"/>
  67. <rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter"/>
  68. <rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis"/>
  69. <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
  70. <rule ref="Drupal.InfoFiles.ClassFiles"/>
  71. <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
  72. <rule ref="Drupal.InfoFiles.Required"/>
  73. <rule ref="Drupal.Semantics.EmptyInstall"/>
  74. <rule ref="Drupal.Semantics.FunctionWatchdog"/>
  75. <rule ref="Drupal.Semantics.InstallHooks"/>
  76. <rule ref="Drupal.Semantics.LStringTranslatable"/>
  77. <rule ref="Drupal.Semantics.PregSecurity"/>
  78. <rule ref="Drupal.Semantics.TInHookMenu"/>
  79. <rule ref="Drupal.Semantics.TInHookSchema"/>
  80. <rule ref="Drupal.WhiteSpace.Comma"/>
  81. <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
  82. <rule ref="Drupal.WhiteSpace.OperatorSpacing"/>
  83. <!-- Generic sniffs -->
  84. <rule ref="Generic.Files.LineEndings"/>
  85. <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  86. <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  87. <rule ref="Generic.PHP.DeprecatedFunctions"/>
  88. <rule ref="Generic.PHP.DisallowShortOpenTag"/>
  89. <rule ref="Generic.PHP.UpperCaseConstant"/>
  90. <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
  91. <!-- PSR-2 sniffs -->
  92. <rule ref="PSR2.Classes.PropertyDeclaration">
  93. <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
  94. </rule>
  95. <!-- Squiz sniffs -->
  96. <rule ref="Squiz.Strings.ConcatenationSpacing">
  97. <properties>
  98. <property name="spacing" value="1"/>
  99. <property name="ignoreNewlines" value="true"/>
  100. </properties>
  101. </rule>
  102. </ruleset>