|
1 | | -# VIP-Coding-Standards |
| 1 | +# VIP Coding Standards |
2 | 2 |
|
3 | | -This project maintains the minimum ruleset of [PHP_CodeSniffer rules](https://github.com/squizlabs/PHP_CodeSniffer) (sniffs) to validate code developed for [WordPress.com VIP](https://wpvip.com/). |
| 3 | +This project contains [PHP_CodeSniffer (PHPCS) sniffs and rulesets](https://github.com/squizlabs/PHP_CodeSniffer) to validate code developed for [WordPress.com VIP](https://wpvip.com/). |
4 | 4 |
|
5 | | -This project contains 2 PHP Codesniffer rulesets: |
| 5 | +This project contains two rulesets: |
6 | 6 |
|
7 | | - - `WordPressVIPMinimum` - for use on WordPress.com projects |
8 | | - - `WordPress-VIP-Go` - for use on VIP Go projects |
| 7 | + - `WordPressVIPMinimum` - for use with projects on the (older) WordPress.com VIP platform. |
| 8 | + - `WordPress-VIP-Go` - for use with projects on the (newer) VIP Go platform. |
9 | 9 |
|
10 | | -These rulesets contain only the rules which are considered being "blockers" and "warnings" according to the [WordPress VIP Go documentation](https://wpvip.com/documentation/vip-go/code-review-blockers-warnings-notices/) |
| 10 | +These rulesets contain only the rules which are considered to be "errors" and "warnings" according to the [WordPress VIP Go documentation](https://wpvip.com/documentation/vip-go/code-review-blockers-warnings-notices/) |
11 | 11 |
|
12 | | -The ruleset takes advantage of existing rules in the [WordPress-Coding-Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) project. |
| 12 | +The rulesets use rules from the [WordPress-Coding-Standards](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) (WPCS) project. |
13 | 13 |
|
14 | | -Go to https://wpvip.com/documentation/phpcs-review-feedback/ to learn about why various things are flagged as errors vs warnings and what the levels mean for us. |
| 14 | +Go to https://wpvip.com/documentation/phpcs-review-feedback/ to learn about why violations are flagged as errors vs warnings and what the levels mean. |
15 | 15 |
|
16 | | -## Installation |
| 16 | +## Minimal requirements |
17 | 17 |
|
18 | | -### Note |
| 18 | +* [PHPCS 3.3.1+](https://github.com/squizlabs/PHP_CodeSniffer/releases) |
| 19 | +* [WPCS 2.*](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases) |
19 | 20 |
|
20 | | -Currently, the VIP Go Coding Standards are built on top of the WordPress Coding Standards 1.* release. If you are using `master` here, you will need to checkout [1.2.1 tag](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases/tag/1.2.1). |
| 21 | +## Installation |
21 | 22 |
|
22 | | -First, make sure you have WPCS 1.* and PHPCS v3+ installed. If you do not, please refer to the [installation instructions for installing PHP CodeSniffer for WordPress.com VIP](https://vip.wordpress.com/documentation/how-to-install-php-code-sniffer-for-wordpress-com-vip/). Note that VIPCS does not currently work with the `develop` or `master` branch of WPCS. |
| 23 | +`composer require automattic/vipwpcs`, or `composer g require automattic/vipwpcs` if installing globally. |
23 | 24 |
|
24 | | -You will also find additional information at the [WordPress Coding Standards for PHP_CodeSniffer project](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards#installation). |
| 25 | +This will install the latest compatible versions of PHPCS and WPCS. |
25 | 26 |
|
26 | | -Then, clone this repo to your local machine, and add the standard to PHPCodeSniffer by appending the folder you cloned into to the end of the installed paths. e.g. |
27 | 27 |
|
28 | | -`phpcs --config-set installed_paths [/path/to/wpcsstandard],[path/to/vipcsstandard],etc` |
| 28 | +Please refer to the [installation instructions for installing PHP_CodeSniffer for WordPress.com VIP](https://wpvip.com/documentation/how-to-install-php-code-sniffer-for-wordpress-com-vip/) for more details. |
29 | 29 |
|
30 | | -Alternatively, we recommend the [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer), which handles the registration of all of the installed standards, so there is no need to set the `installed_paths` config value manually, for single or multiple standards. |
| 30 | +We recommend the [PHP_CodeSniffer Standards Composer Installer Plugin](https://github.com/Dealerdirect/phpcodesniffer-composer-installer), which handles the registration of all of the installed standards, so there is no need to set the `installed_paths` config value manually, for single or multiple standards. |
31 | 31 |
|
32 | | -### Minimal requirements |
| 32 | +Alternatively, you should register the standard to PHPCS by appending the VIPCS directory to the end of the installed paths. e.g. |
33 | 33 |
|
34 | | -* [PHPCS 3+](https://github.com/squizlabs/PHP_CodeSniffer/releases) |
35 | | -* [WPCS 1.*](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/releases) |
| 34 | +`phpcs --config-set installed_paths [/path/to/wpcsstandard],[path/to/vipcsstandard],etc` |
36 | 35 |
|
37 | | -### Setup note |
| 36 | +## Contribution |
38 | 37 |
|
39 | | -Should you wish to run both standards (WordPress.com VIP minimum standard & WordPress.com VIP coding standard), you can add both to PHPCS by running the following configuration command: |
| 38 | +Please see [CONTRIBUTION.md](CONTRIBUTING.md). |
40 | 39 |
|
41 | | -`phpcs --config-set installed_paths [/path/to/standard],[path/to/standard]` |
| 40 | +## License |
42 | 41 |
|
43 | | -Note the comma separating each standard. |
| 42 | +Licensed under [GPL-2.0-or-later](LICENSE.md). |
0 commit comments