Skip to content

Commit 91e5453

Browse files
committed
PHPCS: add a ruleset for this project
The file is completely documented in-line.
1 parent c2049bd commit 91e5453

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

phpcs.xml.dist

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="WP-CLI-import">
3+
<description>Custom ruleset for WP-CLI import-command</description>
4+
5+
<!--
6+
#############################################################################
7+
COMMAND LINE ARGUMENTS
8+
For help understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
9+
For help using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage
10+
#############################################################################
11+
-->
12+
13+
<!-- What to scan -->
14+
<file>.</file>
15+
16+
<!-- Ignoring select files/folders
17+
https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage#ignoring-files-and-folders -->
18+
<exclude-pattern>*/node_modules/*</exclude-pattern>
19+
<exclude-pattern>*/vendor/*</exclude-pattern>
20+
21+
<!-- Show progress. -->
22+
<arg value="p"/>
23+
24+
<!-- Strip the filepaths down to the relevant bit. -->
25+
<arg name="basepath" value="./"/>
26+
27+
<!-- Check up to 8 files simultanously. -->
28+
<arg name="parallel" value="8"/>
29+
30+
<!--
31+
#############################################################################
32+
USE THE WPCliCS RULESET
33+
#############################################################################
34+
-->
35+
36+
<rule ref="WPCliCS">
37+
<!-- The two instances which trigger this sniff in this project are example filenames in documentation. -->
38+
<exclude name="WordPress.WP.CapitalPDangit" />
39+
</rule>
40+
41+
<!--
42+
#############################################################################
43+
PROJECT SPECIFIC CONFIGURATION FOR SNIFFS
44+
#############################################################################
45+
-->
46+
47+
<!-- For help understanding the `testVersion` configuration setting:
48+
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
49+
<config name="testVersion" value="5.4-"/>
50+
51+
<!-- Verify that everything in the global namespace is either namespaced or prefixed.
52+
See: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki/Customizable-sniff-properties#naming-conventions-prefix-everything-in-the-global-namespace -->
53+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals">
54+
<properties>
55+
<property name="prefixes" type="array">
56+
<element value="WP_CLI\Import"/><!-- Namespaces. -->
57+
<element value="wpcli_import"/><!-- Global variables and such. -->
58+
</property>
59+
</properties>
60+
</rule>
61+
62+
<!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. -->
63+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
64+
<exclude-pattern>*/src/Import_Command\.php$</exclude-pattern>
65+
</rule>
66+
67+
</ruleset>

0 commit comments

Comments
 (0)