Repository navigation
Expand file tree
/
Copy pathphpcs.xml.dist
More file actions
134 lines (117 loc) · 5.37 KB
/
Copy pathphpcs.xml.dist
File metadata and controls
134 lines (117 loc) · 5.37 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
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
<?xml version="1.0"?>
<ruleset
name="WordPress Coding Standards for Features Plugin"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/PHPCSStandards/PHP_CodeSniffer/master/phpcs.xsd"
>
<description>Sniffs for this features plugin, extending the shared rtCamp WordPress standard.</description>
<!-- ==========================================================
The shared rtCamp WordPress standard.
rtCampWP : full strict (declare strict_types, short arrays,
WPCS + VIP + Docs + PHPCompatibilityWP + Slevomat).
rtCampWP-Basic : lenient variant without strict typing.
========================================================== -->
<rule ref="rtCampWP" />
<!-- ==========================================================
Project constraints.
========================================================== -->
<!-- Lowest PHP version supported (used by PHPCompatibilityWP). -->
<config name="testVersion" value="8.2-"/>
<!-- Lowest WordPress version supported. -->
<config name="minimum_wp_version" value="6.9"/>
<!-- ==========================================================
Project-specific configuration rtCampWP cannot know.
========================================================== -->
<!-- Allow PSR-4 PascalCase filenames (e.g. `Autoloader.php`, `Core/Assets.php`). -->
<rule ref="WordPress.Files.FileName">
<exclude name="WordPress.Files.FileName.InvalidClassFileName" />
<exclude name="WordPress.Files.FileName.NotHyphenatedLowercase" />
</rule>
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="project-name-features"/>
<element value="default"/>
</property>
</properties>
</rule>
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="project_name_features"/>
<element value="PROJECT_NAME_FEATURES"/>
<element value="Project_Name\Features"/>
<!-- Legacy helpers predate the `_features` suffix. Keep them working. -->
<element value="project_name"/>
</property>
</properties>
<exclude-pattern>tests/*</exclude-pattern>
<exclude-pattern>src/blocks/*/render.php</exclude-pattern>
</rule>
<!-- Relax noisy rules in test files. Test code legitimately changes runtime
config, does /tmp file ops and log capture, fetches fixtures, reassigns
WordPress core globals, and documents methods by name. -->
<rule ref="WordPress-Docs">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.WP.GlobalVariablesOverride.Prohibited">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPress.PHP.IniSet">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPressVIPMinimum.Functions.RestrictedFunctions">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="WordPressVIPMinimum.Performance.FetchingRemoteData">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<rule ref="Generic.Commenting.DocComment.ShortNotCapital">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<!-- The abstract TestCase base is intentionally empty; the empty-braces sniff
cannot be satisfied for an empty class (it wants both one line after the
opening brace and zero before the closing brace). -->
<rule ref="SlevomatCodingStandard.Classes.EmptyLinesAroundClassBraces">
<exclude-pattern>tests/*</exclude-pattern>
</rule>
<!-- These files carry `// wp:example:<key>` marker comments that the init
engine matches verbatim to add/remove capabilities; they are structural,
not prose, so they cannot take trailing punctuation. -->
<rule ref="Squiz.Commenting.InlineComment.InvalidEndChar">
<exclude-pattern>inc/Main.php</exclude-pattern>
<exclude-pattern>inc/Core/Assets.php</exclude-pattern>
<exclude-pattern>inc/Core/PluginSetup.php</exclude-pattern>
</rule>
<!-- Block render.php files are generated by @wordpress/create-block and carry
their own header conventions, not a PHP file docblock. -->
<rule ref="Squiz.Commenting.FileComment">
<exclude-pattern>src/blocks/*/render.php</exclude-pattern>
</rule>
<rule ref="PSR12.Files.FileHeader">
<exclude-pattern>src/blocks/*/render.php</exclude-pattern>
</rule>
<!-- Util::shared() is a PHPStan generic (`@param class-string<T>` -> `@return T`);
the native hint can only be `string`, so the docblock intentionally differs. -->
<rule ref="Squiz.Commenting.FunctionComment.IncorrectTypeHint">
<exclude-pattern>inc/Helpers/Util.php</exclude-pattern>
</rule>
<!-- ==========================================================
How to scan.
========================================================== -->
<arg value="s"/>
<arg name="extensions" value="php"/>
<file>.</file>
<!-- Strip the filepaths down to the relevant bit. -->
<arg name="basepath" value="./"/>
<!-- Check up to 20 files simultaneously. -->
<arg name="parallel" value="20"/>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>/assets/build/js/*.asset.php</exclude-pattern>
<exclude-pattern>*/.github/*</exclude-pattern>
<exclude-pattern>*/.lando/*</exclude-pattern>
<!-- Exclude wordpress dir if using Lando -->
<exclude-pattern>/wordpress/*</exclude-pattern>
</ruleset>