-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
95 lines (84 loc) 路 4.35 KB
/
Copy pathphpcs.xml.dist
File metadata and controls
95 lines (84 loc) 路 4.35 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
94
95
<?xml version="1.0" ?>
<ruleset name="stream-http">
<description>Drupal coding standards, with the project's deliberate deviations.</description>
<file>src</file>
<file>tests</file>
<arg name="extensions" value="php" />
<arg value="sp" />
<arg name="colors" />
<rule ref="Drupal">
<!--
The project comment style for `//` comments is lowercase with no trailing period.
These two sniffs demand the opposite, and they apply ONLY to inline comments.
Every Drupal.Commenting.DocComment.* sniff stays enabled, because a `/** */` block
is real documentation and Drupal's capital-and-full-stop rule is correct there.
-->
<exclude name="Drupal.Commenting.InlineComment.NotCapital" />
<exclude name="Drupal.Commenting.InlineComment.InvalidEndChar" />
</rule>
<rule ref="DrupalPractice" />
<!--
Drupal's default is 80. This repo formats everything else at printWidth 100
(see .prettierrc), and two different limits in one repo is incoherent.
-->
<rule ref="Drupal.Files.LineLength">
<properties>
<property name="lineLimit" value="100" />
</properties>
</rule>
<!--
PHP's streamWrapper prototype mandates these exact snake_case method names; the engine
looks up `stream_open`, `stream_read`, `url_stat` and the rest literally. Renaming them to
camelCase would silently stop the wrapper from working, so this sniff is wrong here
specifically rather than inconvenient. The whole of src/ is that prototype.
-->
<rule ref="Drupal.NamingConventions.ValidFunctionName.ScopeNotCamelCaps">
<exclude-pattern>src/*</exclude-pattern>
</rule>
<!--
The sniff wants globals prefixed like `$_modulename_foo`, which is for module files.
These are counters in a standalone test harness that never runs inside Drupal.
-->
<rule ref="Drupal.NamingConventions.ValidGlobal">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<!--
#region layout is not phpcs's job in this repo
The house style is TABS rendered 4 wide at a 100-char line limit (.editorconfig,
.prettierrc), and `@prettier/plugin-php` is what enforces it. The Drupal standard
hard-codes 2 SPACES and Drupal's own brace placement, so the two tools cannot both be
right about layout and phpcs loses that argument.
Generic.WhiteSpace.DisallowTabIndent is the direct contradiction: it reports "tabs are
not allowed" on every indented line in the repo.
Drupal.Arrays.Array.ArrayIndentation is on this list, reversing what this repo's
CLAUDE.md used to say. That note was written while the tree was 2-space formatted, where
the sniff could fire for a real reason (a wrapped concatenation reading as sibling array
elements). Under tab indentation it can never pass: it asserts "parent indent + 2 spaces"
against a file with no indent spaces, so it fires on every array element regardless of
content. A rule that cannot pass carries no signal.
The casing one has prior art: mantle2, the production Drupal module in this workspace, is
1,276 lowercase `true`/`false`/`null` against 1 uppercase.
UseGlobalClass.RedundantUseStatement is the odd one out because it is not whitespace: it
wants `\Closure` and `\Throwable` written inline instead of imported. The house rule is the
opposite: always `use`, then the short name, with no leading-backslash inline reference even
for a one-word class name. So the sniff loses. Prior art is the sibling driver repo, whose
phpcs.xml.dist excludes exactly this sniff at line 52.
-->
<rule ref="Drupal">
<exclude name="Generic.PHP.UpperCaseConstant.Found" />
<exclude name="Drupal.Classes.UseGlobalClass.RedundantUseStatement" />
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
<exclude name="Drupal.WhiteSpace.ScopeIndent" />
<exclude name="Drupal.WhiteSpace.ObjectOperatorIndent" />
<exclude name="Drupal.WhiteSpace.ScopeClosingBrace" />
<exclude name="Drupal.Arrays.Array.ArrayIndentation" />
<exclude name="Drupal.Classes.ClassDeclaration.BraceOnNewLine" />
<exclude name="Drupal.Classes.ClassDeclaration.CloseBraceAfterBody" />
<exclude name="Drupal.Functions.MultiLineFunctionDeclaration.BraceOnNewLine" />
<exclude name="Drupal.Functions.MultiLineFunctionDeclaration.Indent" />
<exclude name="Drupal.ControlStructures.ControlSignature.NewlineAfterCloseBrace" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing.AfterLast" />
<exclude name="Squiz.WhiteSpace.FunctionSpacing.BeforeFirst" />
</rule>
<!-- #endregion -->
</ruleset>