Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / phpcs.xml.dist
1 <?xml version="1.0" encoding="UTF-8"?>
2 <ruleset name="drupal_core">
3   <description>Default PHP CodeSniffer configuration for Drupal core.</description>
4   <file>.</file>
5   <file>scripts/drupal.sh</file>
6   <file>scripts/password-hash.sh</file>
7   <file>scripts/rebuild_token_calculator.sh</file>
8   <file>scripts/run-tests.sh</file>
9   <file>scripts/update-countries.sh</file>
10   <arg name="extensions" value="inc,install,module,php,profile,test,theme"/>
11
12   <!--Exclude third party code.-->
13   <exclude-pattern>./assets/vendor/*</exclude-pattern>
14
15   <!--Exclude test files that are intentionally empty, or intentionally violate coding standards.-->
16   <exclude-pattern>./modules/system/tests/fixtures/HtaccessTest</exclude-pattern>
17
18   <!-- Exclude third-party code maintained within core that does not follow our standards. -->
19   <!-- @todo This rule may be removed when https://www.drupal.org/node/1848264 is resolved. -->
20   <exclude-pattern>./core/lib/Drupal/Component/Diff/</exclude-pattern>
21
22   <!-- Only include specific sniffs that pass. This ensures that, if new sniffs are added, HEAD does not fail.-->
23   <!-- Drupal sniffs -->
24   <rule ref="Drupal.Classes.ClassCreateInstance"/>
25   <rule ref="Drupal.Classes.ClassDeclaration"/>
26   <rule ref="Drupal.Classes.FullyQualifiedNamespace"/>
27   <rule ref="Drupal.Classes.InterfaceName"/>
28   <rule ref="Drupal.Classes.UnusedUseStatement"/>
29   <rule ref="Drupal.Classes.UseLeadingBackslash"/>
30   <rule ref="Drupal.CSS.ClassDefinitionNameSpacing"/>
31   <rule ref="Drupal.CSS.ColourDefinition"/>
32   <rule ref="Drupal.Commenting.ClassComment">
33     <exclude name="Drupal.Commenting.ClassComment.Missing"/>
34   </rule>
35   <rule ref="Drupal.Commenting.DataTypeNamespace"/>
36   <rule ref="Drupal.Commenting.DocComment">
37     <!-- Sniff for these errors: SpacingAfterTagGroup, WrongEnd, SpacingBetween,
38       ContentAfterOpen, SpacingBeforeShort, TagValueIndent, ShortStartSpace,
39       SpacingAfter -->
40     <exclude name="Drupal.Commenting.DocComment.LongNotCapital"/>
41     <!-- ParamNotFirst still not decided for PHPUnit-based tests.
42       @see https://www.drupal.org/node/2253915 -->
43     <exclude name="Drupal.Commenting.DocComment.ParamNotFirst"/>
44     <exclude name="Drupal.Commenting.DocComment.SpacingBeforeTags"/>
45     <exclude name="Drupal.Commenting.DocComment.LongFullStop"/>
46     <exclude name="Drupal.Commenting.DocComment.ShortNotCapital"/>
47     <exclude name="Drupal.Commenting.DocComment.ShortFullStop"/>
48     <!-- TagsNotGrouped and ParamGroup have false-positives.
49       @see https://www.drupal.org/node/2060925 -->
50     <exclude name="Drupal.Commenting.DocComment.TagsNotGrouped"/>
51     <exclude name="Drupal.Commenting.DocComment.ParamGroup"/>
52     <exclude name="Drupal.Commenting.DocComment.ShortSingleLine"/>
53     <exclude name="Drupal.Commenting.DocComment.TagGroupSpacing"/>
54     <exclude name="Drupal.Commenting.DocComment.MissingShort"/>
55   </rule>
56   <rule ref="Drupal.Commenting.DocCommentStar"/>
57   <rule ref="Drupal.Commenting.FileComment"/>
58   <rule ref="Drupal.Commenting.FunctionComment">
59     <exclude name="Drupal.Commenting.FunctionComment.IncorrectTypeHint"/>
60     <exclude name="Drupal.Commenting.FunctionComment.InvalidNoReturn"/>
61     <exclude name="Drupal.Commenting.FunctionComment.InvalidTypeHint"/>
62     <exclude name="Drupal.Commenting.FunctionComment.Missing"/>
63     <exclude name="Drupal.Commenting.FunctionComment.MissingParamComment"/>
64     <exclude name="Drupal.Commenting.FunctionComment.MissingParamType"/>
65     <exclude name="Drupal.Commenting.FunctionComment.MissingReturnComment"/>
66     <exclude name="Drupal.Commenting.FunctionComment.MissingReturnType"/>
67     <exclude name="Drupal.Commenting.FunctionComment.ParamCommentFullStop"/>
68     <exclude name="Drupal.Commenting.FunctionComment.ParamMissingDefinition"/>
69     <exclude name="Drupal.Commenting.FunctionComment.TypeHintMissing"/>
70   </rule>
71   <rule ref="Drupal.Commenting.VariableComment">
72     <!-- Sniff for: DuplicateVar, EmptyVar, InlineVariableName -->
73     <exclude name="Drupal.Commenting.VariableComment.IncorrectVarType"/>
74     <exclude name="Drupal.Commenting.VariableComment.MissingVar"/>
75     <exclude name="Drupal.Commenting.VariableComment.VarOrder"/>
76     <exclude name="Drupal.Commenting.VariableComment.WrongStyle"/>
77   </rule>
78   <rule ref="Drupal.Commenting.InlineComment">
79     <!-- Sniff for: NoSpaceBefore, WrongStyle -->
80     <exclude name="Drupal.Commenting.InlineComment.DocBlock"/>
81     <exclude name="Drupal.Commenting.InlineComment.InvalidEndChar"/>
82     <exclude name="Drupal.Commenting.InlineComment.NotCapital"/>
83     <exclude name="Drupal.Commenting.InlineComment.SpacingAfter"/>
84     <exclude name="Drupal.Commenting.InlineComment.SpacingBefore"/>
85   </rule>
86   <rule ref="Drupal.Commenting.PostStatementComment"/>
87   <rule ref="Drupal.ControlStructures.ElseIf"/>
88   <rule ref="Drupal.ControlStructures.ControlSignature"/>
89   <rule ref="Drupal.ControlStructures.InlineControlStructure"/>
90   <rule ref="Drupal.Files.EndFileNewline"/>
91   <rule ref="Drupal.Files.FileEncoding"/>
92   <rule ref="Drupal.Files.TxtFileLineLength"/>
93   <rule ref="Drupal.Formatting.MultiLineAssignment"/>
94   <rule ref="Drupal.Formatting.SpaceInlineIf"/>
95   <rule ref="Drupal.Formatting.SpaceUnaryOperator"/>
96   <rule ref="Drupal.Functions.DiscouragedFunctions"/>
97   <rule ref="Drupal.Functions.FunctionDeclaration"/>
98   <rule ref="Drupal.InfoFiles.AutoAddedKeys"/>
99   <rule ref="Drupal.InfoFiles.ClassFiles"/>
100   <rule ref="Drupal.InfoFiles.DuplicateEntry"/>
101   <rule ref="Drupal.InfoFiles.Required"/>
102   <rule ref="Drupal.Methods.MethodDeclaration">
103     <!-- Silence method name underscore warning which is covered already in
104       Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps. -->
105     <exclude name="Drupal.Methods.MethodDeclaration.Underscore"/>
106   </rule>
107   <rule ref="Drupal.NamingConventions.ValidVariableName">
108     <!-- Sniff for: LowerStart -->
109     <exclude name="Drupal.NamingConventions.ValidVariableName.LowerCamelName"/>
110   </rule>
111   <rule ref="Drupal.Scope.MethodScope"/>
112   <rule ref="Drupal.Semantics.EmptyInstall"/>
113   <rule ref="Drupal.Semantics.FunctionAlias"/>
114   <rule ref="Drupal.Semantics.FunctionT">
115     <exclude name="Drupal.Semantics.FunctionT.NotLiteralString"/>
116     <exclude name="Drupal.Semantics.FunctionT.ConcatString"/>
117   </rule>
118   <rule ref="Drupal.Semantics.FunctionWatchdog"/>
119   <rule ref="Drupal.Semantics.InstallHooks"/>
120   <rule ref="Drupal.Semantics.LStringTranslatable"/>
121   <rule ref="Drupal.Semantics.PregSecurity"/>
122   <rule ref="Drupal.Semantics.TInHookMenu"/>
123   <rule ref="Drupal.Semantics.TInHookSchema"/>
124   <rule ref="Drupal.WhiteSpace.CloseBracketSpacing"/>
125   <rule ref="Drupal.WhiteSpace.Comma"/>
126   <rule ref="Drupal.WhiteSpace.EmptyLines"/>
127   <rule ref="Drupal.WhiteSpace.Namespace"/>
128   <rule ref="Drupal.WhiteSpace.ObjectOperatorIndent"/>
129   <rule ref="Drupal.WhiteSpace.ObjectOperatorSpacing"/>
130   <rule ref="Drupal.WhiteSpace.OpenBracketSpacing"/>
131   <rule ref="Drupal.WhiteSpace.OpenTagNewline"/>
132   <rule ref="Drupal.WhiteSpace.OperatorSpacing"/>
133   <rule ref="Drupal.WhiteSpace.ScopeClosingBrace"/>
134   <rule ref="Drupal.WhiteSpace.ScopeIndent"/>
135
136   <!-- Drupal Practice sniffs -->
137   <rule ref="DrupalPractice.Commenting.ExpectedException"/>
138
139   <!-- Generic sniffs -->
140   <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
141   <rule ref="Generic.Files.ByteOrderMark"/>
142   <rule ref="Generic.Files.LineEndings"/>
143   <rule ref="Generic.Formatting.SpaceAfterCast"/>
144   <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
145   <rule ref="Generic.Functions.OpeningFunctionBraceKernighanRitchie">
146     <properties>
147       <property name="checkClosures" value="true"/>
148     </properties>
149   </rule>
150   <rule ref="Generic.NamingConventions.ConstructorName"/>
151   <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
152   <rule ref="Generic.PHP.DeprecatedFunctions"/>
153   <rule ref="Generic.PHP.DisallowShortOpenTag"/>
154   <rule ref="Generic.PHP.LowerCaseKeyword"/>
155   <rule ref="Generic.PHP.UpperCaseConstant"/>
156   <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
157
158   <!-- MySource sniffs -->
159   <rule ref="MySource.Debug.DebugCode"/>
160
161   <!-- PEAR sniffs -->
162   <rule ref="PEAR.Files.IncludingFile"/>
163   <!-- Disable some error messages that we do not want. -->
164   <rule ref="PEAR.Files.IncludingFile.UseIncludeOnce">
165     <severity>0</severity>
166   </rule>
167   <rule ref="PEAR.Files.IncludingFile.UseInclude">
168     <severity>0</severity>
169   </rule>
170   <rule ref="PEAR.Files.IncludingFile.UseRequireOnce">
171     <severity>0</severity>
172   </rule>
173   <rule ref="PEAR.Files.IncludingFile.UseRequire">
174     <severity>0</severity>
175   </rule>
176   <rule ref="PEAR.Functions.ValidDefaultValue"/>
177
178   <!-- PEAR sniffs -->
179   <rule ref="PEAR.Functions.FunctionCallSignature"/>
180   <!-- The sniffs inside PEAR.Functions.FunctionCallSignature silenced below are
181     also silenced in Drupal CS' ruleset.xml. The code below is a 1-on-1 copy
182     from that file. -->
183   <!-- Disable some error messages that we already cover. -->
184   <rule ref="PEAR.Functions.FunctionCallSignature.SpaceAfterOpenBracket">
185     <severity>0</severity>
186   </rule>
187   <rule ref="PEAR.Functions.FunctionCallSignature.SpaceBeforeCloseBracket">
188     <severity>0</severity>
189   </rule>
190   <!-- Disable some error messages that we do not want. -->
191   <rule ref="PEAR.Functions.FunctionCallSignature.Indent">
192     <severity>0</severity>
193   </rule>
194   <rule ref="PEAR.Functions.FunctionCallSignature.ContentAfterOpenBracket">
195     <severity>0</severity>
196   </rule>
197   <rule ref="PEAR.Functions.FunctionCallSignature.CloseBracketLine">
198     <severity>0</severity>
199   </rule>
200   <rule ref="PEAR.Functions.FunctionCallSignature.EmptyLine">
201     <severity>0</severity>
202   </rule>
203
204   <!-- PSR-2 sniffs -->
205   <rule ref="PSR2.Classes.PropertyDeclaration">
206     <exclude name="PSR2.Classes.PropertyDeclaration.Underscore"/>
207   </rule>
208   <rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
209   <rule ref="PSR2.Namespaces.UseDeclaration">
210     <exclude name="PSR2.Namespaces.UseDeclaration.UseAfterNamespace"/>
211   </rule>
212
213   <!-- Squiz sniffs -->
214   <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
215   <rule ref="Squiz.Arrays.ArrayDeclaration">
216     <exclude name="Squiz.Arrays.ArrayDeclaration.NoKeySpecified"/>
217     <exclude name="Squiz.Arrays.ArrayDeclaration.KeySpecified"/>
218   </rule>
219   <!-- Disable some error messages that we do not want. -->
220   <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
221     <severity>0</severity>
222   </rule>
223   <rule ref="Squiz.Arrays.ArrayDeclaration.DoubleArrowNotAligned">
224     <severity>0</severity>
225   </rule>
226   <rule ref="Squiz.Arrays.ArrayDeclaration.FirstValueNoNewline">
227     <severity>0</severity>
228   </rule>
229   <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
230     <severity>0</severity>
231   </rule>
232   <rule ref="Squiz.Arrays.ArrayDeclaration.MultiLineNotAllowed">
233     <severity>0</severity>
234   </rule>
235   <rule ref="Squiz.Arrays.ArrayDeclaration.NoComma">
236     <severity>0</severity>
237   </rule>
238   <rule ref="Squiz.Arrays.ArrayDeclaration.NoCommaAfterLast">
239     <severity>0</severity>
240   </rule>
241   <rule ref="Squiz.Arrays.ArrayDeclaration.NotLowerCase">
242     <severity>0</severity>
243   </rule>
244   <rule ref="Squiz.Arrays.ArrayDeclaration.SingleLineNotAllowed">
245     <severity>0</severity>
246   </rule>
247   <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
248     <severity>0</severity>
249   </rule>
250   <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNoNewline">
251     <severity>0</severity>
252   </rule>
253   <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration"/>
254   <!-- Disable some error messages that we already cover. -->
255   <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.AsNotLower">
256     <severity>0</severity>
257   </rule>
258   <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceAfterOpen">
259     <severity>0</severity>
260   </rule>
261   <rule ref="Squiz.ControlStructures.ForEachLoopDeclaration.SpaceBeforeClose">
262     <severity>0</severity>
263   </rule>
264   <rule ref="Squiz.ControlStructures.ForLoopDeclaration"/>
265   <!-- Disable some error messages that we already cover. -->
266   <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingAfterOpen">
267     <severity>0</severity>
268   </rule>
269   <rule ref="Squiz.ControlStructures.ForLoopDeclaration.SpacingBeforeClose">
270     <severity>0</severity>
271   </rule>
272   <rule ref="Squiz.Functions.MultiLineFunctionDeclaration"/>
273   <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
274     <severity>0</severity>
275   </rule>
276   <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.ContentAfterBrace">
277     <severity>0</severity>
278   </rule>
279   <!-- Standard yet to be finalized on this (https://www.drupal.org/node/1539712). -->
280   <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.FirstParamSpacing">
281     <severity>0</severity>
282   </rule>
283   <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.Indent">
284     <severity>0</severity>
285   </rule>
286   <rule ref="Squiz.Functions.MultiLineFunctionDeclaration.CloseBracketLine">
287     <severity>0</severity>
288   </rule>
289   <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing">
290     <properties>
291       <property name="equalsSpacing" value="1"/>
292     </properties>
293   </rule>
294   <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing.NoSpaceBeforeArg">
295     <severity>0</severity>
296   </rule>
297   <rule ref="Squiz.PHP.LowercasePHPFunctions"/>
298   <rule ref="Squiz.Strings.ConcatenationSpacing">
299     <properties>
300       <property name="spacing" value="1"/>
301       <property name="ignoreNewlines" value="true"/>
302     </properties>
303   </rule>
304   <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing" />
305   <rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
306   <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
307
308   <!-- Zend sniffs -->
309   <rule ref="Zend.Files.ClosingTag"/>
310
311 </ruleset>