Skip to content

Commit da74f16

Browse files
committed
README/USING: add instructions on how projects can use the base ruleset
1 parent 149a7fc commit da74f16

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

.readme-partials/USING.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,38 @@ To make use of the WP-CLI testing framework, you need to complete the following
4141
```
4242
This will make sure that the automated Behat system works across all platforms. This is needed on Windows.
4343

44-
5. Update your composer dependencies and regenerate your autoloader and binary folders:
44+
5. Optionally add a `phpcs.xml.dist` file to the package root to enable code style and best practice checks using PHP_CodeSniffer.
45+
46+
Example of a minimal custom ruleset based on the defaults set in the WP-CLI testing framework:
47+
```xml
48+
<?xml version="1.0"?>
49+
<ruleset name="WP-CLI-PROJECT-NAME">
50+
<description>Custom ruleset for WP-CLI PROJECT NAME</description>
51+
52+
<!-- What to scan. -->
53+
<file>.</file>
54+
55+
<!-- Show progress. -->
56+
<arg value="p"/>
57+
58+
<!-- Strip the filepaths down to the relevant bit. -->
59+
<arg name="basepath" value="./"/>
60+
61+
<!-- Check up to 8 files simultaneously. -->
62+
<arg name="parallel" value="8"/>
63+
64+
<!-- For help understanding the `testVersion` configuration setting:
65+
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
66+
<config name="testVersion" value="5.4-"/>
67+
68+
<!-- Rules: Include the base ruleset for WP-CLI projects. -->
69+
<rule ref="WP_CLI_CS"/>
70+
71+
</ruleset>
72+
```
73+
74+
All other [PHPCS configuration options](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-Ruleset) are, of course, available.
75+
6. Update your composer dependencies and regenerate your autoloader and binary folders:
4576
```bash
4677
composer update
4778
```

0 commit comments

Comments
 (0)