phpcs.xml.dist 4.76 KB
Newer Older
1 2 3 4
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="drupal_core">
  <description>Default PHP CodeSniffer configuration for Drupal core.</description>
  <file>.</file>
5
  <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
6 7 8 9 10 11 12

  <!--Exclude third party code.-->
  <exclude-pattern>./assets/vendor/*</exclude-pattern>

  <!--Exclude test files that are intentionally empty, or intentionally violate coding standards.-->
  <exclude-pattern>./modules/system/tests/fixtures/HtaccessTest</exclude-pattern>

13 14
  <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
  <!-- Drupal sniffs -->
15
  <rule ref="Drupal.Classes.ClassCreateInstance"/>
16
  <rule ref="Drupal.Classes.UnusedUseStatement"/>
17 18 19 20
  <rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
  <rule ref="Drupal.CSS.ColourDefinition"/>
  <rule ref="Drupal.Commenting.DocCommentStar"/>
  <rule ref="Drupal.Commenting.FileComment"/>
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
  <rule ref="Drupal.Commenting.FunctionComment">
    <exclude name="Drupal.Commenting.FunctionComment.IncorrectParamVarName"/>
    <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
    <exclude name="Drupal.Commenting.FunctionComment.$InReturnType"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidReturn"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidTypeHint"/>
    <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingFile"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamName"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNewLine"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentNotCapital"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamNameNoMatch"/>
    <exclude name="Drupal.Commenting.FunctionComment.ReturnCommentIndentation"/>
    <exclude name="Drupal.Commenting.FunctionComment.SeeAdditionalText"/>
    <exclude name="Drupal.Commenting.FunctionComment.SeePunctuation"/>
    <exclude name="Drupal.Commenting.FunctionComment.SpacingAfter"/>
    <exclude name="Drupal.Commenting.FunctionComment.SpacingAfterParamType"/>
    <exclude name="Drupal.Commenting.FunctionComment.ThrowsComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.ThrowsNoFullStop"/>
    <exclude name="Drupal.Commenting.FunctionComment.ThrowsNotCapital"/>
    <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
    <exclude name="Drupal.Commenting.FunctionComment.VoidReturn"/>
    <exclude name="Drupal.Commenting.FunctionComment.WrongStyle"/>
  </rule>
52
  <rule ref="Drupal.ControlStructures.ElseIf"/>
53
  <rule ref="Drupal.Files.EndFileNewline"/>
54
  <rule ref="Drupal.Files.TxtFileLineLength"/>
55
  <rule ref="Drupal.Formatting.SpaceInlineIf"/>
56
  <rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
57
  <rule ref="Drupal.Functions.DiscouragedFunctions"/>
58 59
  <rule ref="Drupal.Functions.FunctionDeclaration.SpaceAfter"/>
  <rule ref="Drupal.Functions.FunctionDeclaration.SpaceBeforeParenthesis"/>
60 61 62 63 64
  <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
  <rule ref="Drupal.InfoFiles.ClassFiles"/>
  <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
  <rule ref="Drupal.InfoFiles.Required"/>
  <rule ref="Drupal.Semantics.EmptyInstall"/>
65 66 67 68 69
  <rule ref="Drupal.Semantics.FunctionT">
    <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
    <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
    <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
  </rule>
70 71 72 73 74 75 76 77
  <rule ref="Drupal.Semantics.FunctionWatchdog"/>
  <rule ref="Drupal.Semantics.InstallHooks"/>
  <rule ref="Drupal.Semantics.LStringTranslatable"/>
  <rule ref="Drupal.Semantics.PregSecurity"/>
  <rule ref="Drupal.Semantics.TInHookMenu"/>
  <rule ref="Drupal.Semantics.TInHookSchema"/>
  <rule ref="Drupal.WhiteSpace.Comma"/>
  <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
78
  <rule ref="Drupal.WhiteSpace.OperatorSpacing"/>
79 80 81

  <!-- Generic sniffs -->
  <rule ref="Generic.Files.LineEndings"/>
82
  <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
83 84 85
  <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  <rule ref="Generic.PHP.DeprecatedFunctions"/>
  <rule ref="Generic.PHP.DisallowShortOpenTag"/>
86
  <rule ref="Generic.PHP.UpperCaseConstant"/>
87 88
  <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>

89
</ruleset>