Repository navigation
Expand file tree
/
Copy path.phpcs.php.xml
More file actions
89 lines (79 loc) · 3.45 KB
/
Copy path.phpcs.php.xml
File metadata and controls
89 lines (79 loc) · 3.45 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
<?xml version="1.0"?>
<ruleset name="WooCommerce Shipping & Tax — PHP">
<description>WooCommerce Shipping & Tax generic PHP coding standards. Mirrors the shipping-plugin family layout; the classes/ and bootstrap suppressions are carried over verbatim from the previous phpcs.xml.dist so this change surfaces no new violations.</description>
<rule ref="./.phpcs.common.xml"/>
<!-- Rules -->
<rule ref="WooCommerce-Core"/>
<rule ref="WordPress-Core"/>
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>
<!--
The Capabilities sniff only knows WordPress core capabilities, so it reports every
correctly-spelled capability that WooCommerce or this plugin registers as "unknown".
Declaring the two we actually use keeps the sniff useful for genuine typos:
- manage_woocommerce is registered by WooCommerce core for the shop_manager role.
- wcship_manage_labels is registered by this plugin for shipping label access.
-->
<rule ref="WordPress.WP.Capabilities">
<properties>
<property name="custom_capabilities" type="array">
<element value="manage_woocommerce"/>
<element value="wcship_manage_labels"/>
</property>
</properties>
</rule>
<rule ref="PHPCompatibility">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<!--
Test files use PascalCase_Underscored naming by convention (e.g. My_Class_Test.php),
and the plugin bootstrap is named for the plugin slug. Suppress file-naming sniffs there.
(woocommerce-services.php exclusion preserved from the previous phpcs.xml.dist.)
src/ is excluded because it is PSR-4 autoloaded (composer.json maps
Automattic\WCServices\ => src/), and PSR-4 requires the file name to match the
class name exactly. The WordPress `class-my-thing.php` convention is
unsatisfiable there, so the sniff reported two unfixable errors on every file
under src/. This exclusion does not apply to classes/, which keeps the
WordPress naming convention.
-->
<rule ref="WordPress.Files.FileName">
<exclude-pattern>tests/</exclude-pattern>
<exclude-pattern>src/</exclude-pattern>
<exclude-pattern>woocommerce-services.php</exclude-pattern>
</rule>
<!--
Tests sometimes need to override WP globals (and restore them after the test).
Exclude the override sniff for tests/ only.
-->
<rule ref="WordPress.WP.GlobalVariablesOverride">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<!--
Test methods use @testdox as their description. Generic.Commenting requires a
prose short description before any tags, which conflicts with @testdox-only
docblocks. Suppress for tests/ only.
-->
<rule ref="Generic.Commenting">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<!--
Tests invoke core filters and actions as test setup; requiring a docblock
for every apply_filters / do_action call in test code adds noise without value.
-->
<rule ref="WooCommerce.Commenting.CommentHooks">
<exclude-pattern>tests/</exclude-pattern>
</rule>
<!--
Preserved from the previous phpcs.xml.dist: the procedural WC_Connect_* classes in
classes/ predate per-file docblocks. Kept to avoid surfacing legacy file-comment
violations here (that cleanup belongs to a later milestone).
-->
<rule ref="Squiz.Commenting.FileComment.MissingPackageTag">
<exclude-pattern>classes/</exclude-pattern>
<exclude-pattern>tests/</exclude-pattern>
</rule>
<rule ref="Squiz.Commenting.FileComment.Missing">
<exclude-pattern>classes/</exclude-pattern>
<exclude-pattern>tests/</exclude-pattern>
</rule>
</ruleset>