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