Chris@17
|
1 <?xml version="1.0"?>
|
Chris@17
|
2 <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Squiz" xsi:noNamespaceSchemaLocation="../../../phpcs.xsd">
|
Chris@17
|
3 <description>The Squiz coding standard.</description>
|
Chris@17
|
4
|
Chris@17
|
5 <!-- Include some specific sniffs -->
|
Chris@17
|
6 <rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
Chris@17
|
7 <rule ref="Generic.CodeAnalysis.EmptyStatement"/>
|
Chris@17
|
8 <rule ref="Generic.Commenting.Todo"/>
|
Chris@17
|
9 <rule ref="Generic.Commenting.DocComment"/>
|
Chris@17
|
10 <rule ref="Generic.ControlStructures.InlineControlStructure"/>
|
Chris@17
|
11 <rule ref="Generic.Formatting.DisallowMultipleStatements"/>
|
Chris@17
|
12 <rule ref="Generic.Formatting.SpaceAfterCast"/>
|
Chris@17
|
13 <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
|
Chris@17
|
14 <rule ref="Generic.NamingConventions.ConstructorName"/>
|
Chris@17
|
15 <rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
|
Chris@17
|
16 <rule ref="Generic.PHP.DeprecatedFunctions"/>
|
Chris@17
|
17 <rule ref="Generic.PHP.DisallowShortOpenTag"/>
|
Chris@17
|
18 <rule ref="Generic.PHP.LowerCaseKeyword"/>
|
Chris@17
|
19 <rule ref="Generic.PHP.LowerCaseConstant"/>
|
Chris@17
|
20 <rule ref="Generic.Strings.UnnecessaryStringConcat"/>
|
Chris@17
|
21 <rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
|
Chris@17
|
22 <rule ref="Generic.WhiteSpace.LanguageConstructSpacing"/>
|
Chris@17
|
23 <rule ref="Generic.WhiteSpace.IncrementDecrementSpacing"/>
|
Chris@17
|
24 <rule ref="Generic.WhiteSpace.ScopeIndent"/>
|
Chris@17
|
25 <rule ref="PEAR.ControlStructures.MultiLineCondition"/>
|
Chris@17
|
26 <rule ref="PEAR.Files.IncludingFile"/>
|
Chris@17
|
27 <rule ref="PEAR.Formatting.MultiLineAssignment"/>
|
Chris@17
|
28 <rule ref="PEAR.Functions.ValidDefaultValue"/>
|
Chris@17
|
29 <rule ref="PSR2.Files.EndFileNewline"/>
|
Chris@17
|
30 <rule ref="Zend.Files.ClosingTag"/>
|
Chris@17
|
31 <rule ref="Zend.Debug.CodeAnalyzer"/>
|
Chris@17
|
32
|
Chris@17
|
33 <!-- Lines can be 120 chars long, but never show errors -->
|
Chris@17
|
34 <rule ref="Generic.Files.LineLength">
|
Chris@17
|
35 <properties>
|
Chris@17
|
36 <property name="lineLimit" value="120"/>
|
Chris@17
|
37 <property name="absoluteLineLimit" value="0"/>
|
Chris@17
|
38 </properties>
|
Chris@17
|
39 </rule>
|
Chris@17
|
40
|
Chris@17
|
41 <!-- Use Unix newlines -->
|
Chris@17
|
42 <rule ref="Generic.Files.LineEndings">
|
Chris@17
|
43 <properties>
|
Chris@17
|
44 <property name="eolChar" value="\n"/>
|
Chris@17
|
45 </properties>
|
Chris@17
|
46 </rule>
|
Chris@17
|
47
|
Chris@17
|
48 <!-- Have 20 chars padding maximum and always show as errors -->
|
Chris@17
|
49 <rule ref="Generic.Formatting.MultipleStatementAlignment">
|
Chris@17
|
50 <properties>
|
Chris@17
|
51 <property name="maxPadding" value="20"/>
|
Chris@17
|
52 <property name="error" value="true"/>
|
Chris@17
|
53 </properties>
|
Chris@17
|
54 </rule>
|
Chris@17
|
55
|
Chris@17
|
56 <!-- Ban some functions -->
|
Chris@17
|
57 <rule ref="Generic.PHP.ForbiddenFunctions">
|
Chris@17
|
58 <properties>
|
Chris@17
|
59 <property name="forbiddenFunctions" type="array">
|
Chris@17
|
60 <element key="sizeof" value="count"/>
|
Chris@17
|
61 <element key="delete" value="unset"/>
|
Chris@17
|
62 <element key="print" value="echo"/>
|
Chris@17
|
63 <element key="is_null" value="null"/>
|
Chris@17
|
64 <element key="create_function" value="null"/>
|
Chris@17
|
65 </property>
|
Chris@17
|
66 </properties>
|
Chris@17
|
67 </rule>
|
Chris@17
|
68
|
Chris@17
|
69 <!-- We allow empty catch statements -->
|
Chris@17
|
70 <rule ref="Generic.CodeAnalysis.EmptyStatement.DetectedCATCH">
|
Chris@17
|
71 <severity>0</severity>
|
Chris@17
|
72 </rule>
|
Chris@17
|
73
|
Chris@17
|
74 <!-- We don't want gsjlint throwing errors for things we already check -->
|
Chris@17
|
75 <rule ref="Generic.Debug.ClosureLinter">
|
Chris@17
|
76 <properties>
|
Chris@17
|
77 <property name="errorCodes" type="array" value="0210"/>
|
Chris@17
|
78 <property name="ignoreCodes" type="array" value="0001,0110,0240"/>
|
Chris@17
|
79 </properties>
|
Chris@17
|
80 </rule>
|
Chris@17
|
81 <rule ref="Generic.Debug.ClosureLinter.ExternalToolError">
|
Chris@17
|
82 <message>%2$s</message>
|
Chris@17
|
83 </rule>
|
Chris@17
|
84
|
Chris@17
|
85 <!-- Only one argument per line in multi-line function calls -->
|
Chris@17
|
86 <rule ref="PEAR.Functions.FunctionCallSignature">
|
Chris@17
|
87 <properties>
|
Chris@17
|
88 <property name="allowMultipleArguments" value="false"/>
|
Chris@17
|
89 </properties>
|
Chris@17
|
90 </rule>
|
Chris@17
|
91
|
Chris@17
|
92 <!-- We use custom indent rules for arrays -->
|
Chris@17
|
93 <rule ref="Generic.Arrays.ArrayIndent"/>
|
Chris@17
|
94 <rule ref="Squiz.Arrays.ArrayDeclaration.KeyNotAligned">
|
Chris@17
|
95 <severity>0</severity>
|
Chris@17
|
96 </rule>
|
Chris@17
|
97 <rule ref="Squiz.Arrays.ArrayDeclaration.ValueNotAligned">
|
Chris@17
|
98 <severity>0</severity>
|
Chris@17
|
99 </rule>
|
Chris@17
|
100 <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNotAligned">
|
Chris@17
|
101 <severity>0</severity>
|
Chris@17
|
102 </rule>
|
Chris@17
|
103 <rule ref="Squiz.Arrays.ArrayDeclaration.CloseBraceNewLine">
|
Chris@17
|
104 <severity>0</severity>
|
Chris@17
|
105 </rule>
|
Chris@17
|
106
|
Chris@17
|
107 <!-- Squiz.WhiteSpace.LanguageConstructSpacing is deprecated -->
|
Chris@17
|
108 <rule ref="Squiz.WhiteSpace.LanguageConstructSpacing">
|
Chris@17
|
109 <severity>0</severity>
|
Chris@17
|
110 </rule>
|
Chris@17
|
111
|
Chris@17
|
112 <!-- Prevent fixer conflict for conflicting rules. -->
|
Chris@17
|
113 <rule ref="Squiz.Commenting.InlineComment">
|
Chris@17
|
114 <exclude name="Squiz.Commenting.InlineComment.SpacingAfterAtFunctionEnd"/>
|
Chris@17
|
115 </rule>
|
Chris@17
|
116
|
Chris@17
|
117 <!-- Private methods MUST not be prefixed with an underscore -->
|
Chris@17
|
118 <rule ref="Squiz.NamingConventions.ValidFunctionName.PrivateNoUnderscore">
|
Chris@17
|
119 <severity>0</severity>
|
Chris@17
|
120 </rule>
|
Chris@17
|
121 <rule ref="PSR2.Methods.MethodDeclaration.Underscore">
|
Chris@17
|
122 <type>error</type>
|
Chris@17
|
123 </rule>
|
Chris@17
|
124
|
Chris@17
|
125 <!-- Private properties MUST not be prefixed with an underscore -->
|
Chris@17
|
126 <rule ref="Squiz.NamingConventions.ValidVariableName.PrivateNoUnderscore">
|
Chris@17
|
127 <severity>0</severity>
|
Chris@17
|
128 </rule>
|
Chris@17
|
129 <rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
|
Chris@17
|
130 <type>error</type>
|
Chris@17
|
131 </rule>
|
Chris@17
|
132 </ruleset>
|