automattic/vipwpcs

PHP_CodeSniffer rules (sniffs) to enforce WordPress VIP minimum coding conventions

Installs: 108 504

Dependents: 23

Suggesters: 0

Stars: 79

Watchers: 9

Forks: 19

Open Issues: 55

Type:phpcodesniffer-standard


README

This project contains PHP_CodeSniffer (PHPCS) sniffs and rulesets to validate code developed for WordPress.com VIP.

This project contains two rulesets:

  • WordPressVIPMinimum - for use with projects on the (older) WordPress.com VIP platform.
  • WordPress-VIP-Go - for use with projects on the (newer) VIP Go platform.

These rulesets contain only the rules which are considered to be "errors" and "warnings" according to the WordPress VIP Go documentation

The rulesets use rules from the WordPress Coding Standards (WPCS) project.

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.

Minimal requirements

Installation

composer require automattic/vipwpcs, or composer g require automattic/vipwpcs if installing globally.

This will install the latest compatible versions of PHPCS and WPCS.

Please refer to the installation instructions for installing PHP_CodeSniffer for WordPress.com VIP for more details.

We recommend the PHP_CodeSniffer Standards Composer Installer Plugin, 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.

Alternatively, you should register the standard to PHPCS by appending the VIPCS directory to the end of the installed paths. e.g.

phpcs --config-set installed_paths [/path/to/wpcsstandard],[path/to/vipcsstandard],etc

Contribution

Please see CONTRIBUTION.md.

License

Licensed under GPL-2.0-or-later.