-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpcs.xml
195 lines (171 loc) · 7.01 KB
/
phpcs.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
<?xml version="1.0"?>
<ruleset name="MySource">
<!--
The name attribute of the ruleset tag is displayed
when running PHP_CodeSniffer with the -v command line
argument. The descripti on tag below is not displayed anywhere
except in this file, so it can contain information for
developers who may change this file in the future.
-->
<description>A custom coding standard</description>
<!--
You can hard-code ignore patterns directly into your
custom standard so you don't have to specify the
patterns on the command line.
The following two tags are equivalent to the command line
argument: --ignore=*/tests/*,*/data/*
-->
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/data/*</exclude-pattern>
<!--
Include all sniffs in the PEAR standard. Note that the
path to the standard does not have to be specified as the
PEAR standard exists inside the PHP_CodeSniffer install
directory.
-->
<rule ref="PEAR"/>
<!--
Include all sniffs in an external standard directory. Note
that we have to specify the full path to the standard's
directory because it does not exist inside the PHP_CodeSniffer
install directory.
-->
<rule ref="/home/username/standards/mystandard"/>
<!--
Include everything in another ruleset.xml file. This is
really handy if you want to customise another developer's
custom standard. They just need to distribute their single
ruleset file to allow this.
-->
<rule ref="/home/username/standards/custom.xml"/>
<!--
Include all sniffs in the Squiz standard except one. Note that
the name of the sniff being excluded is the code that the sniff
is given by PHP_CodeSniffer and is based on the file name and
path of the sniff class. You can display these codes using the
-s command line argument when checking a file.
-->
<rule ref="Squiz">
<exclude name="Squiz.PHP.CommentedOutCode"/>
</rule>
<!--
Include some specific sniffs from the Generic standard.
Note again that the name of the sniff is the code that
PHP_CodeSniffer gives it.
-->
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
<rule ref="Generic.Commenting.Todo"/>
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
<!--
Here we are including a specific sniff but also changing
the error message of a specific message inside the sniff.
Note that the specific code for the message, which is
CommentFound in this case, is defined by the sniff developer.
You can display these codes by using the -s command line
argument when checking a file.
Also note that this message has a variable inside it,
which is why it is important that sniffs use a printf style
format for their error messages.
We also drop the severity of this message from the
default value (5) so that it is hidden by default. It can be
displayed by setting the minimum severity on the PHP_CodeSniffer
command line. This is great if you want to use some messages
only in code reviews and not have them block code commits.
-->
<rule ref="Generic.Commenting.Todo.CommentFound">
<message>Please review this TODO comment: %s</message>
<severity>3</severity>
</rule>
<!--
Here we change two messages from the same sniff. Note how the
codes are slightly different because the sniff developer has
defined both a MaxExceeded message and a TooLong message. In the
case of this sniff, one is used for warnings and one is used
for errors.
-->
<rule ref="Generic.Files.LineLength.MaxExceeded">
<message>Line contains %s chars, which is longer than the max limit of %s</message>
</rule>
<rule ref="Generic.Files.LineLength.TooLong">
<message>Line longer than %s characters; contains %s characters</message>
</rule>
<!--
Some sniffs have public member vars that allow you to
customise specific elements of the sniff. In the case of
the Generic LineLength sniff, you can customise the limit
at which the sniff will throw warnings and the limit at
which it will throw errors.
The rule below includes the LineLength sniff but changes the
settings so the sniff will show warnings for any line longer
than 90 chars and errors for any line longer than 100 chars.
-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="90"/>
<property name="absoluteLineLimit" value="100"/>
</properties>
</rule>
<!--
Another useful example of changing sniff settings is
to specify the end of line character that your standard
should check for.
-->
<rule ref="Generic.Files.LineEndings">
<properties>
<property name="eolChar" value="\r\n"/>
</properties>
</rule>
<!--
Boolean values should be specified by using the strings
"true" and "false" rather than the integers 0 and 1.
-->
<rule ref="Generic.Formatting.MultipleStatementAlignment">
<properties>
<property name="maxPadding" value="8"/>
<property name="ignoreMultiLine" value="true"/>
<property name="error" value="true"/>
</properties>
</rule>
<!--
If you want to completely disable an error message in a sniff
but you don't want to exclude the whole sniff, you can
change the severity of the message to 0. In this case, we
want the Squiz DoubleQuoteUsage sniff to be included in our
standard, but we don't want the ContainsVar error message to
ever be displayed.
-->
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<severity>0</severity>
</rule>
<!--
There is a special internal error message produced by PHP_CodeSniffer
when it is unable to detect code in a file, possible due to
the use of short open tags even though php.ini disables them.
You can disable this message in the same way as sniff messages.
Again, the code here will be displayed in the PHP_CodeSniffer
output when using the -s command line argument while checking a file.
-->
<rule ref="Internal.NoCodeFound">
<severity>0</severity>
</rule>
<!--
You can also hard-code ignore patterns for specific sniffs,
a feature not available on the command line.
The code here will hide all messages from the Squiz DoubleQuoteUsage
sniff for files that match either of the two exclude patterns.
-->
<rule ref="Squiz.Strings.DoubleQuoteUsage">
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/data/*</exclude-pattern>
</rule>
<!--
You can also be more specific and just exclude some messages.
The code here will just hide the ContainsVar error generated by the
Squiz DoubleQuoteUsage sniff for files that match either of the two
exclude patterns.
-->
<rule ref="Squiz.Strings.DoubleQuoteUsage.ContainsVar">
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/data/*</exclude-pattern>
</rule>
</ruleset>