2 <ruleset name="Drupal coding standards">
3 <description>Drupal 8 coding standards</description>
6 <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
8 <!--Exclude third party code.-->
9 <exclude-pattern>./vendor/*</exclude-pattern>
10 <!--Run Drupal standards.-->
11 <rule ref="Drupal.Array"/>
12 <rule ref="Drupal.Classes"/>
13 <rule ref="Drupal.Commenting">
14 <!-- TagsNotGrouped and ParamGroup have false-positives.
15 @see https://www.drupal.org/node/2060925 -->
16 <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
17 <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
19 <rule ref="Drupal.ControlStructures"/>
20 <rule ref="Drupal.CSS"/>
21 <rule ref="Drupal.Files"/>
22 <rule ref="Drupal.Formatting"/>
23 <rule ref="Drupal.Functions"/>
24 <rule ref="Drupal.InfoFiles"/>
25 <rule ref="Drupal.Methods"/>
26 <rule ref="Drupal.NamingConventions"/>
27 <rule ref="Drupal.Scope"/>
28 <rule ref="Drupal.Semantics"/>
29 <rule ref="Drupal.Strings"/>
30 <rule ref="Drupal.WhiteSpace"/>
32 <!-- Drupal Practice sniffs -->
33 <rule ref="DrupalPractice.Commenting"/>
35 <!-- Generic sniffs -->
36 <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
37 <rule ref="Generic.Files.ByteOrderMark"/>
38 <rule ref="Generic.Files.LineEndings"/>
39 <rule ref="Generic.Formatting.SpaceAfterCast"/>
40 <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
41 <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
43 <property name="checkClosures" value="true"/>
46 <rule ref="Generic.NamingConventions.ConstructorName"/>
47 <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
48 <rule ref="Generic.PHP.DeprecatedFunctions"/>
49 <rule ref="Generic.PHP.DisallowShortOpenTag"/>
50 <rule ref="Generic.PHP.LowerCaseKeyword"/>
51 <rule ref="Generic.PHP.UpperCaseConstant"/>
52 <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
54 <!-- MySource sniffs -->
55 <rule ref="MySource.Debug.DebugCode"/>
58 <rule ref="PEAR.Files.IncludingFile"/>
59 <!-- Disable some error messages that we do not want. -->
60 <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
61 <severity>0</severity>
63 <rule ref="PEAR.Files.IncludingFile.UseInclude">
64 <severity>0</severity>
66 <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
67 <severity>0</severity>
69 <rule ref="PEAR.Files.IncludingFile.UseRequire">
70 <severity>0</severity>
72 <rule ref="PEAR.Functions.ValidDefaultValue"/>
75 <rule ref="PEAR.Functions.FunctionCallSignature"/>
76 <!-- The sniffs inside PEAR.Functions.FunctionCallSignature silenced below are
77 also silenced in Drupal CS' ruleset.xml. The code below is a 1-on-1 copy
79 <!-- Disable some error messages that we already cover. -->
80 <rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
81 <severity>0</severity>
83 <rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
84 <severity>0</severity>
86 <!-- Disable some error messages that we do not want. -->
87 <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
88 <severity>0</severity>
90 <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
91 <severity>0</severity>
93 <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
94 <severity>0</severity>
96 <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
97 <severity>0</severity>
100 <!-- PSR-2 sniffs -->
101 <rule ref="PSR2.Classes.PropertyDeclaration">
102 <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
104 <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
105 <rule ref="PSR2.Namespaces.UseDeclaration">
106 <exclude name="PSR2.Namespaces.UseDeclaration.UseAfterNamespace"/>
109 <!-- Squiz sniffs -->
110 <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
111 <rule ref="Squiz.Arrays.ArrayDeclaration">
112 <exclude name="Squiz.Arrays.ArrayDeclaration.NoKeySpecified"/>
113 <exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified"/>
115 <!-- Disable some error messages that we do not want. -->
116 <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
117 <severity>0</severity>
119 <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
120 <severity>0</severity>
122 <rule ref="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline">
123 <severity>0</severity>
125 <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
126 <severity>0</severity>
128 <rule ref="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed">
129 <severity>0</severity>
131 <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
132 <severity>0</severity>
134 <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
135 <severity>0</severity>
137 <rule ref="Squiz.Arrays.ArrayDeclaration.NotLowerCase">
138 <severity>0</severity>
140 <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
141 <severity>0</severity>
143 <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
144 <severity>0</severity>
146 <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNoNewline">
147 <severity>0</severity>
149 <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
150 <!-- Disable some error messages that we already cover. -->
151 <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
152 <severity>0</severity>
154 <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
155 <severity>0</severity>
157 <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
158 <severity>0</severity>
160 <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
161 <!-- Disable some error messages that we already cover. -->
162 <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
163 <severity>0</severity>
165 <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
166 <severity>0</severity>
168 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
169 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
170 <severity>0</severity>
172 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
173 <severity>0</severity>
175 <!-- Standard yet to be finalized on this (https://www.drupal.org/node/1539712). -->
176 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing">
177 <severity>0</severity>
179 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.Indent">
180 <severity>0</severity>
182 <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine">
183 <severity>0</severity>
185 <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
187 <property name="equalsSpacing" value="1"/>
190 <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg">
191 <severity>0</severity>
193 <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
194 <rule ref="Squiz.Strings.ConcatenationSpacing">
196 <property name="spacing" value="1"/>
197 <property name="ignoreNewlines" value="true"/>
200 <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
201 <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
202 <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
205 <rule ref="Zend.Files.ClosingTag"/>