Repository navigation
Expand file tree
/
Copy pathruleset.xml
More file actions
93 lines (78 loc) · 3.75 KB
/
Copy pathruleset.xml
File metadata and controls
93 lines (78 loc) · 3.75 KB
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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="WP_CLI_CS_Feature_Files" xsi:noNamespaceSchemaLocation="../vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Coding standard for the PHP blocks embedded in Behat feature files</description>
<!--
The defaults for the code style check of the PHP blocks that Behat feature
files embed in docstrings, used by `run-phpcs-tests` and by
`run-phpcbf-cleanup`.
Keeping them in one place is what makes the check and the fixer agree: a
sniff left out for one but not the other would have the fixer rewrite
feature files over something the check never reports, or have the check
report something the fixer refuses to touch.
A package replaces these defaults wholesale by adding a
`phpcs-feature-files.xml` (or `phpcs-feature-files.xml.dist`) ruleset to its
root, which is then used as the standard instead.
-->
<!-- Warnings are advisory, and the fixer must not rewrite a feature file
over something the check does not report. -->
<arg name="warning-severity" value="0"/>
<rule ref="WP_CLI_CS">
<!--
A block is not a file. It is padded with one empty line per preceding
line of the feature file so that reported line numbers match it, and one
that does not bring its own opening tag is given one. Neither is part of
the snippet, and the shared docstring indentation is taken off before the
check and put back afterwards, so none of the sniffs looking at a file as
a whole apply.
-->
<exclude name="Generic.Files.InlineHTML"/>
<exclude name="Generic.Files.LineEndings"/>
<exclude name="PSR2.Files.EndFileNewline"/>
<exclude name="PSR12.Files.FileHeader"/>
<exclude name="Squiz.Commenting.FileComment"/>
<exclude name="Generic.PHP.RequireStrictTypes"/>
<exclude name="WordPress.Files.FileName"/>
<exclude name="Universal.WhiteSpace.PrecisionAlignment"/>
<!--
A block is a fixture, not production code. Snippets exist to set up a
scenario, run inside a throwaway WordPress installation, are written to
be read at a glance, and are routinely a single class or function on
their own.
-->
<exclude name="WordPress.NamingConventions.PrefixAllGlobals"/>
<exclude name="WordPress.WP.GlobalVariablesOverride"/>
<exclude name="WordPress.PHP.YodaConditions"/>
<exclude name="Universal.Files.SeparateFunctionsFromOO"/>
<exclude name="Generic.Files.OneObjectStructurePerFile"/>
<exclude name="Universal.Namespaces.OneDeclarationPerFile"/>
<exclude name="Universal.Namespaces.DisallowCurlyBraceSyntax"/>
<exclude name="Universal.Namespaces.DisallowDeclarationWithoutName"/>
<exclude name="PSR2.Methods.FunctionClosingBrace"/>
<!-- A snippet testing error handling is deliberately incomplete. -->
<exclude name="Generic.CodeAnalysis.EmptyStatement"/>
<!-- A feature file indents with spaces. -->
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent"/>
</rule>
<!-- The other way round, so that a block arriving with tabs is brought in line. -->
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
<rule ref="Generic.WhiteSpace.ScopeIndent">
<properties>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<rule ref="WordPress.Arrays.ArrayIndentation">
<properties>
<property name="tabIndent" value="false"/>
</properties>
</rule>
<!--
The fixer leaves whitespace behind wherever it breaks a line, so this sniff
has to run. Only the two message codes that look at the file as a whole are
in the way: taking the padding off a block would shift every line number
reported against the feature file it came from.
-->
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.StartFile"/>
<exclude name="Squiz.WhiteSpace.SuperfluousWhitespace.EndFile"/>
</rule>
</ruleset>