-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathphpcs.xml
More file actions
109 lines (98 loc) · 4.73 KB
/
phpcs.xml
File metadata and controls
109 lines (98 loc) · 4.73 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?xml version="1.0"?>
<ruleset name="Newspack Monorepo Coding Standards">
<description>Single shared PHPCS configuration for all Newspack plugins, themes, and packages.</description>
<arg value="sp"/>
<arg name="colors"/>
<arg name="extensions" value="php"/>
<arg name="parallel" value="8"/>
<!-- Shared base rule sets. -->
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress-VIP-Go"/>
<!-- Project-wide exclusions. AGENTS.md: short array syntax is allowed,
Yoda conditions not required. -->
<rule ref="WordPress">
<exclude name="Generic.Arrays.DisallowShortArraySyntax.Found"/>
<exclude name="Universal.Arrays.DisallowShortArraySyntax.Found"/>
<exclude name="Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound"/>
<exclude name="Squiz.Functions.MultiLineFunctionDeclaration.SpaceAfterFunction"/>
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
<exclude name="Generic.Formatting.MultipleStatementAlignment.NotSameWarning"/>
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.FoundAfterLastUsed"/>
<exclude name="Universal.NamingConventions.NoReservedKeywordParameterNames"/>
<exclude name="Generic.CodeAnalysis.UnusedFunctionParameter.Found"/>
</rule>
<!-- Custom capabilities defined by Newspack plugins (newspack-plugin,
newspack-multibranded-site). Listed at root so WP.Capabilities does
not flag legitimate cap names. -->
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="newspack_view_others_media"/>
<element value="manage_woocommerce"/>
</property>
</properties>
</rule>
<!-- republication-tracker-tool's main file is named without the standard
class-<name>.php convention; keep that exception monorepo-wide. -->
<rule ref="WordPress.Files.FileName.InvalidClassFileName">
<exclude-pattern>*/plugins/republication-tracker-tool/*</exclude-pattern>
</rule>
<!-- Newspack custom sniffs. ForbiddenMethods (loose) applies broadly so
callers across the monorepo are nudged toward
Newspack_Newsletters_Contacts. ForbiddenContactsMethods (strict, with
service-providers/ exemption) only makes sense inside the newsletters
plugin, where it disciplines internal callers. The first ref registers
the standard; the per-sniff refs that follow only refine scope. -->
<rule ref="./phpcsSniffs"/>
<rule ref="phpcsSniffs.Newsletters.ForbiddenMethods">
<exclude-pattern>*/plugins/newspack-newsletters/*</exclude-pattern>
</rule>
<rule ref="phpcsSniffs.Newsletters.ForbiddenContactsMethods">
<include-pattern>*/plugins/newspack-newsletters/*</include-pattern>
</rule>
<!-- newspack-theme has classic-theme conventions that pre-date the
stricter commenting/indent sniffs WordPress-Extra enables; preserve
the prior per-theme exclusions rather than reformat the theme. -->
<rule ref="Squiz.Commenting.FileComment.SpacingAfterComment">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FunctionComment.MissingParamTag">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.InlineComment.NotCapital">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.Incorrect">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="Generic.WhiteSpace.ScopeIndent.IncorrectExact">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="PEAR.Functions.FunctionCallSignature.Indent">
<exclude-pattern>*/themes/newspack-theme/*</exclude-pattern>
</rule>
<rule ref="PHPCompatibilityWP"/>
<config name="testVersion" value="8.0-"/>
<config name="minimum_wp_version" value="6.6"/>
<!-- Scan only in-scope monorepo code. -->
<file>plugins</file>
<file>themes</file>
<file>packages</file>
<!-- Build output, deps, autogenerated asset manifests, and test fixtures. -->
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/dev-lib/*</exclude-pattern>
<exclude-pattern>*/dist/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/release/*</exclude-pattern>
<exclude-pattern>*/assets/dist/*</exclude-pattern>
<exclude-pattern>*/*.asset.php</exclude-pattern>
<exclude-pattern>*/tests/fixtures/*</exclude-pattern>
<!-- Skipped in legacy per-package configs; tests had laxer norms. -->
<exclude-pattern>*/plugins/newspack-blocks/tests/*</exclude-pattern>
<exclude-pattern>*/themes/newspack-theme/tests/*</exclude-pattern>
</ruleset>