1 <?xml version="1.0" encoding="UTF-8"?>
2 <ruleset name="drupal_core">
3 <description>PHP CodeSniffer configuration</description>
5 <arg name="extensions" value="install,module,php"/>
7 <!--Exclude third party code.-->
8 <exclude-pattern>./vendor/*</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="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassCreateInstanceSniff.php"/>
13 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/ClassDeclarationSniff.php"/>
14 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/FullyQualifiedNamespaceSniff.php"/>
15 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UnusedUseStatementSniff.php"/>
16 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Classes/UseLeadingBackslashSniff.php"/>
17 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ClassDefinitionNameSpacingSniff.php"/>
18 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/CSS/ColourDefinitionSniff.php"/>
19 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/ClassCommentSniff.php">
20 <exclude name="Drupal.Commenting.ClassComment.Missing"/>
22 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentSniff.php">
23 <!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween,
24 ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace,
26 <exclude name="Drupal.Commenting.DocComment.LongNotCapital"/>
27 <!-- ParamNotFirst still not decided for PHPUnit-based tests.
28 @see https://www.drupal.org/node/2253915 -->
29 <exclude name="Drupal.Commenting.DocComment.ParamNotFirst"/>
30 <exclude name="Drupal.Commenting.DocComment.SpacingBeforeTags"/>
31 <exclude name="Drupal.Commenting.DocComment.LongFullStop"/>
32 <exclude name="Drupal.Commenting.DocComment.ShortNotCapital"/>
33 <exclude name="Drupal.Commenting.DocComment.ShortFullStop"/>
34 <!-- TagsNotGrouped and ParamGroup have false-positives.
35 @see https://www.drupal.org/node/2060925 -->
36 <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
37 <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
38 <exclude name="Drupal.Commenting.DocComment.ShortSingleLine"/>
39 <exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/>
40 <exclude name="Drupal.Commenting.DocComment.MissingShort"/>
42 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/DocCommentStarSniff.php"/>
43 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FileCommentSniff.php"/>
44 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Commenting/FunctionCommentSniff.php">
45 <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
46 <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
47 <exclude name="Drupal.Commenting.FunctionComment.InvalidReturnNotVoid"/>
48 <exclude name="Drupal.Commenting.FunctionComment.InvalidTypeHint"/>
49 <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
50 <exclude name="Drupal.Commenting.FunctionComment.MissingFile"/>
51 <exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
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.ParamCommentIndentation"/>
57 <exclude name="Drupal.Commenting.FunctionComment.ParamMissingDefinition"/>
58 <exclude name="Drupal.Commenting.FunctionComment.ParamNameNoMatch"/>
59 <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
61 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ElseIfSniff.php"/>
62 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/ControlStructures/ControlSignatureSniff.php"/>
63 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/EndFileNewlineSniff.php"/>
64 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Files/TxtFileLineLengthSniff.php"/>
65 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/MultiLineAssignmentSniff.php"/>
66 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceInlineIfSniff.php"/>
67 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Formatting/SpaceUnaryOperatorSniff.php"/>
68 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php"/>
69 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/FunctionDeclarationSniff.php"/>
70 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/AutoAddedKeysSniff.php"/>
71 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/ClassFilesSniff.php"/>
72 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/DuplicateEntrySniff.php"/>
73 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/InfoFiles/RequiredSniff.php"/>
74 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/NamingConventions/ValidVariableNameSniff.php">
75 <!-- Sniff for: LowerStart -->
76 <exclude name="Drupal.NamingConventions.ValidVariableName.LowerCamelName"/>
78 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Scope/MethodScopeSniff.php"/>
79 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/EmptyInstallSniff.php"/>
80 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionTSniff.php">
81 <exclude name="Drupal.Semantics.FunctionT.BackslashSingleQuote"/>
82 <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
83 <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
85 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionWatchdogSniff.php"/>
86 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/InstallHooksSniff.php"/>
87 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/LStringTranslatableSniff.php"/>
88 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/PregSecuritySniff.php"/>
89 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookMenuSniff.php"/>
90 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/TInHookSchemaSniff.php"/>
91 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/CommaSniff.php"/>
92 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/EmptyLinesSniff.php"/>
93 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorIndentSniff.php"/>
94 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ObjectOperatorSpacingSniff.php"/>
95 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OpenTagNewlineSniff.php"/>
96 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/OperatorSpacingSniff.php"/>
97 <rule ref="vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/WhiteSpace/ScopeIndentSniff.php"/>
99 <!-- Drupal Practice sniffs -->
100 <rule ref="vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/Commenting/ExpectedExceptionSniff.php"/>
102 <!-- Generic sniffs -->
103 <rule ref="Generic.Files.LineEndings"/>
104 <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
105 <rule ref="Generic.NamingConventions.ConstructorName" />
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"/>