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