comparison vendor/squizlabs/php_codesniffer/phpcs.xml.dist @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
1 <?xml version="1.0"?> 1 <?xml version="1.0"?>
2 <ruleset name="PHP_CodeSniffer"> 2 <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="PHP_CodeSniffer" xsi:noNamespaceSchemaLocation="phpcs.xsd">
3 <description>The coding standard for PHP_CodeSniffer itself.</description> 3 <description>The coding standard for PHP_CodeSniffer itself.</description>
4 4
5 <file>CodeSniffer.php</file> 5 <file>autoload.php</file>
6 <file>CodeSniffer</file> 6 <file>bin</file>
7 <file>scripts</file> 7 <file>scripts</file>
8 <file>src</file>
9 <file>tests</file>
8 10
9 <exclude-pattern>*/Tests/*</exclude-pattern> 11 <exclude-pattern>*/Standards/*/Tests/*\.(inc|css|js)</exclude-pattern>
10 12
11 <arg value="np"/> 13 <arg name="basepath" value="."/>
14 <arg name="colors"/>
15 <arg name="parallel" value="75"/>
16 <arg value="np"/>
12 17
13 <rule ref="PHPCS"/> 18 <!-- Don't hide tokenizer exceptions -->
19 <rule ref="Internal.Tokenizer.Exception">
20 <type>error</type>
21 </rule>
22
23 <!-- Include the whole PEAR standard -->
24 <rule ref="PEAR">
25 <exclude name="PEAR.NamingConventions.ValidFunctionName"/>
26 <exclude name="PEAR.NamingConventions.ValidVariableName"/>
27 <exclude name="PEAR.Commenting.ClassComment"/>
28 <exclude name="PEAR.Commenting.FileComment.MissingCategoryTag"/>
29 <exclude name="PEAR.Commenting.FileComment.MissingPackageTag"/>
30 <exclude name="PEAR.Commenting.FileComment.MissingLinkTag"/>
31 <exclude name="PEAR.Commenting.FileComment.MissingVersion"/>
32 <exclude name="PEAR.Commenting.InlineComment"/>
33 </rule>
34
35 <!-- Include some sniffs from other standards that don't conflict with PEAR -->
36 <rule ref="Squiz.Arrays.ArrayBracketSpacing"/>
37 <rule ref="Squiz.Arrays.ArrayDeclaration"/>
38 <rule ref="Squiz.Commenting.ClosingDeclarationComment"/>
39 <rule ref="Squiz.ControlStructures.ControlSignature"/>
40 <rule ref="Squiz.ControlStructures.ElseIfDeclaration"/>
41 <rule ref="Squiz.Commenting.BlockComment"/>
42 <rule ref="Squiz.Commenting.DocCommentAlignment"/>
43 <rule ref="Squiz.Commenting.EmptyCatchComment"/>
44 <rule ref="Squiz.Commenting.InlineComment"/>
45 <rule ref="Squiz.Commenting.LongConditionClosingComment"/>
46 <rule ref="Squiz.Commenting.PostStatementComment"/>
47 <rule ref="Squiz.Commenting.VariableComment"/>
48 <rule ref="Squiz.Formatting.OperatorBracket"/>
49 <rule ref="Squiz.Functions.FunctionDeclarationArgumentSpacing"/>
50 <rule ref="Squiz.Operators.ComparisonOperatorUsage"/>
51 <rule ref="Squiz.PHP.DisallowInlineIf"/>
52 <rule ref="Squiz.Scope.MethodScope"/>
53 <rule ref="Squiz.Strings.ConcatenationSpacing"/>
54 <rule ref="Squiz.WhiteSpace.ControlStructureSpacing"/>
55 <rule ref="Squiz.WhiteSpace.FunctionClosingBraceSpace"/>
56 <rule ref="Squiz.WhiteSpace.FunctionSpacing"/>
57 <rule ref="Squiz.WhiteSpace.OperatorSpacing"/>
58 <rule ref="Squiz.WhiteSpace.SuperfluousWhitespace"/>
59 <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
60 <rule ref="Generic.Commenting.Todo"/>
61 <rule ref="Generic.ControlStructures.InlineControlStructure"/>
62 <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
63 <rule ref="Generic.Formatting.SpaceAfterCast"/>
64 <rule ref="Generic.NamingConventions.ConstructorName"/>
65 <rule ref="Generic.PHP.DeprecatedFunctions"/>
66 <rule ref="Generic.PHP.LowerCaseKeyword"/>
67 <rule ref="Generic.Strings.UnnecessaryStringConcat"/>
68 <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
69 <rule ref="PSR2.Classes.PropertyDeclaration"/>
70 <rule ref="PSR2.Methods.MethodDeclaration"/>
71 <rule ref="PSR2.Files.EndFileNewline"/>
72 <rule ref="Zend.Files.ClosingTag"/>
73
74 <!-- PEAR uses warnings for inline control structures, so switch back to errors -->
75 <rule ref="Generic.ControlStructures.InlineControlStructure">
76 <properties>
77 <property name="error" value="true"/>
78 </properties>
79 </rule>
80
81 <!-- We use custom indent rules for arrays -->
82 <rule ref="Generic.Arrays.ArrayIndent"/>
83 <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
84 <severity>0</severity>
85 </rule>
86 <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
87 <severity>0</severity>
88 </rule>
89 <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
90 <severity>0</severity>
91 </rule>
92 <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
93 <severity>0</severity>
94 </rule>
95
96 <!-- Check var names, but we don't want leading underscores for private vars -->
97 <rule ref="Squiz.NamingConventions.ValidVariableName"/>
98 <rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
99 <severity>0</severity>
100 </rule>
101
102 <!-- Only one argument per line in multi-line function calls -->
103 <rule ref="PEAR.Functions.FunctionCallSignature">
104 <properties>
105 <property name="allowMultipleArguments" value="false"/>
106 </properties>
107 </rule>
108
109 <!-- Have 12 chars padding maximum and always show as errors -->
110 <rule ref="Generic.Formatting.MultipleStatementAlignment">
111 <properties>
112 <property name="maxPadding" value="12"/>
113 <property name="error" value="true"/>
114 </properties>
115 </rule>
116
117 <!-- Ban some functions -->
118 <rule ref="Generic.PHP.ForbiddenFunctions">
119 <properties>
120 <property name="forbiddenFunctions" type="array">
121 <element key="sizeof" value="count"/>
122 <element key="delete" value="unset"/>
123 <element key="print" value="echo"/>
124 <element key="is_null" value="null"/>
125 <element key="create_function" value="null"/>
126 </property>
127 </properties>
128 </rule>
129
130 <!-- Private methods MUST not be prefixed with an underscore -->
131 <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
132 <type>error</type>
133 </rule>
134
135 <!-- Private properties MUST not be prefixed with an underscore -->
136 <rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
137 <type>error</type>
138 </rule>
139
140 <!-- The testing bootstrap file uses string concats to stop IDEs seeing the class aliases -->
141 <rule ref="Generic.Strings.UnnecessaryStringConcat">
142 <exclude-pattern>tests/bootstrap.php</exclude-pattern>
143 </rule>
144
14 </ruleset> 145 </ruleset>