phpcs.xml.dist 9.47 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 15 16
  <!-- Exclude third-party code maintained within core that does not follow our standards. -->
  <!-- @todo This rule may be removed when https://www.drupal.org/node/1848264 is resolved. -->
  <exclude-pattern>./core/lib/Drupal/Component/Diff/</exclude-pattern>

17 18
  <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
  <!-- Drupal sniffs -->
19
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Array/DisallowLongArraySyntaxSniff.php"/>
20 21 22 23
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassCreateInstanceSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/FullyQualifiedNamespaceSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UnusedUseStatementSniff.php"/>
24
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UseLeadingBackslashSniff.php"/>
25 26 27
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php">
28 29
    <exclude name="Drupal.Commenting.ClassComment.Missing"/>
  </rule>
30
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php">
31
    <!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween,
32 33
      ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace,
      SpacingAfter -->
34
    <exclude name="Drupal.Commenting.DocComment.LongNotCapital"/>
35 36
    <!-- ParamNotFirst still not decided for PHPUnit-based tests.
      @see https://www.drupal.org/node/2253915 -->
37 38 39 40 41
    <exclude name="Drupal.Commenting.DocComment.ParamNotFirst"/>
    <exclude name="Drupal.Commenting.DocComment.SpacingBeforeTags"/>
    <exclude name="Drupal.Commenting.DocComment.LongFullStop"/>
    <exclude name="Drupal.Commenting.DocComment.ShortNotCapital"/>
    <exclude name="Drupal.Commenting.DocComment.ShortFullStop"/>
42 43
    <!-- TagsNotGrouped and ParamGroup have false-positives.
      @see https://www.drupal.org/node/2060925 -->
44
    <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
45
    <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
46 47 48 49
    <exclude name="Drupal.Commenting.DocComment.ShortSingleLine"/>
    <exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/>
    <exclude name="Drupal.Commenting.DocComment.MissingShort"/>
  </rule>
50 51 52
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentStarSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php">
53 54 55 56 57 58 59 60 61 62
    <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/>
    <exclude name="Drupal.Commenting.FunctionComment.InvalidTypeHint"/>
    <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
    <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/>
63 64
    <exclude name="Drupal.Commenting.FunctionComment.ParamCommentIndentation"/>
    <exclude name="Drupal.Commenting.FunctionComment.ParamMissingDefinition"/>
65 66
    <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
  </rule>
67 68 69
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ElseIfSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ControlSignatureSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/EndFileNewlineSniff.php"/>
70
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/FileEncodingSniff.php"/>
71
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/TxtFileLineLengthSniff.php"/>
72
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php"/>
73 74 75 76 77 78 79 80
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceInlineIfSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceUnaryOperatorSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/FunctionDeclarationSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/AutoAddedKeysSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/RequiredSniff.php"/>
81 82 83 84
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidVariableNameSniff.php">
    <!-- Sniff for: LowerStart -->
    <exclude name="Drupal.NamingConventions.ValidVariableName.LowerCamelName"/>
  </rule>
85 86 87
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/EmptyInstallSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php">
88 89 90 91
    <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
    <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
    <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
  </rule>
92 93 94 95 96 97 98
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionWatchdogSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/InstallHooksSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/LStringTranslatableSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/PregSecuritySniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookMenuSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookSchemaSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/CommaSniff.php"/>
99
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/EmptyLinesSniff.php"/>
100
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/NamespaceSniff.php"/>
101 102 103 104 105
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OperatorSpacingSniff.php"/>
  <rule ref="../vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php"/>
106

107
  <!-- Drupal Practice sniffs -->
108
  <rule ref="../vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php"/>
109

110
  <!-- Generic sniffs -->
111
  <rule ref="Generic.Files.ByteOrderMark"/>
112
  <rule ref="Generic.Files.LineEndings"/>
113
  <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
114
  <rule ref="Generic.NamingConventions.ConstructorName"/>
115 116 117
  <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
  <rule ref="Generic.PHP.DeprecatedFunctions"/>
  <rule ref="Generic.PHP.DisallowShortOpenTag"/>
118
  <rule ref="Generic.PHP.UpperCaseConstant"/>
119
  <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138

  <!-- MySource sniffs -->
  <rule ref="MySource.Debug.DebugCode"/>

  <!-- PEAR sniffs -->
  <rule ref="PEAR.Files.IncludingFile"/>
  <!-- Disable some error messages that we do not want. -->
  <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
    <severity>0</severity>
  </rule>
  <rule ref="PEAR.Files.IncludingFile.UseInclude">
    <severity>0</severity>
  </rule>
  <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
    <severity>0</severity>
  </rule>
  <rule ref="PEAR.Files.IncludingFile.UseRequire">
    <severity>0</severity>
  </rule>
139

140 141 142 143 144
  <!-- PSR-2 sniffs -->
  <rule ref="PSR2.Classes.PropertyDeclaration">
    <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
  </rule>

145
  <!-- Squiz sniffs -->
146
  <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
147 148 149 150 151
  <rule ref="Squiz.Strings.ConcatenationSpacing">
    <properties>
      <property name="spacing" value="1"/>
      <property name="ignoreNewlines" value="true"/>
    </properties>
152 153 154 155
  </rule>

  <!-- Zend sniffs -->
  <rule ref="Zend.Files.ClosingTag"/>
156

157
</ruleset>