-
Notifications
You must be signed in to change notification settings - Fork 46
Expand file tree
/
Copy path.phpcs.xml.dist
More file actions
83 lines (72 loc) · 3.55 KB
/
Copy path.phpcs.xml.dist
File metadata and controls
83 lines (72 loc) · 3.55 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
<?xml version="1.0"?>
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="Custom Metadata Manager" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd">
<description>Coding standards for the Custom Metadata Manager plugin.</description>
<!-- What to scan: the whole plugin, excluding dependencies, tests and generated files. -->
<file>.</file>
<exclude-pattern>*/build/*</exclude-pattern>
<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
<!-- How to scan. -->
<arg value="sp"/><!-- Show sniff codes and progress. -->
<arg name="basepath" value="."/><!-- Strip file paths down to the relevant bit. -->
<arg name="colors"/><!-- Colour the output. Disable if working on Windows. -->
<arg name="extensions" value="php"/><!-- Only scan PHP files. -->
<arg name="parallel" value="8"/><!-- Run sniffs in parallel for faster results. -->
<!-- Rules: WordPress VIP coding standards. WordPress-Extra includes WordPress-Core. -->
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>
<rule ref="WordPress-VIP-Go"/>
<config name="minimum_supported_wp_version" value="6.4"/>
<!-- Rules: check cross-version PHP compatibility. -->
<rule ref="PHPCompatibilityWP"/>
<config name="testVersion" value="7.4-"/>
<!-- Ensure everything in the global namespace is prefixed. -->
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
<properties>
<property name="prefixes" type="array">
<element value="custom_metadata"/>
<element value="x_add_metadata"/>
</property>
</properties>
<!-- The examples file is illustrative demo code; its callbacks are meant to be copied and renamed. -->
<exclude-pattern>custom_metadata_examples.php</exclude-pattern>
</rule>
<!-- Ensure the text domain is used consistently. -->
<rule ref="WordPress.WP.I18n">
<properties>
<property name="text_domain" type="array">
<element value="custom-metadata"/>
</property>
</properties>
</rule>
<!-- Require a blank line check around control structures. -->
<rule ref="WordPress.WhiteSpace.ControlStructureSpacing">
<properties>
<property name="blank_line_check" value="true"/>
</properties>
</rule>
<!--
The following are intentional and documented, not oversights. Addressing them would break
backwards compatibility or the plugin's published identity, so they are suppressed rather
than "fixed". See https://github.com/Automattic/custom-metadata/issues/147 for context.
-->
<!-- The manager class keeps its historical snake_case name in the global namespace for backwards
compatibility (a global $custom_metadata_manager is documented as public API). -->
<rule ref="PEAR.NamingConventions.ValidClassName">
<exclude-pattern>includes/class-custom-metadata-manager.php</exclude-pattern>
</rule>
<!-- The plugin file names are part of its published identity on WordPress.org; renaming them
would break activation state on existing installs and the deploy tooling. -->
<rule ref="WordPress.Files.FileName">
<severity>0</severity>
</rule>
<!-- Legacy pseudo-private underscore-prefixed members. Renaming is a breaking change (several are
hook callbacks referenced by name) tracked in issue #156; remove these once that lands. -->
<rule ref="PSR2.Methods.MethodDeclaration.Underscore">
<exclude-pattern>includes/class-custom-metadata-manager.php</exclude-pattern>
</rule>
<rule ref="PSR2.Classes.PropertyDeclaration.Underscore">
<exclude-pattern>includes/class-custom-metadata-manager.php</exclude-pattern>
</rule>
</ruleset>