PhpDev.App
Automattic/VIP-Coding-Standards

Automattic/VIP-Coding-Standards

Stars: 204

Forks: 39

Pull Requests: 431

Issues: 366

Watchers: 11

Last Updated: 2023-09-14 09:05:45

PHP_CodeSniffer ruleset to enforce WordPress VIP coding standards.

License: Other

Languages: PHP, JavaScript, Shell, CSS

https://wpvip.com/documentation/how-to-install-php-code-sniffer-for-wordpress-com-vip/

VIP Coding Standards

This project contains PHP_CodeSniffer (PHPCS) sniffs and rulesets to validate code developed for WordPress 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, as well as the VariableAnalysis standard.

Go to https://docs.wpvip.com/technical-references/code-review/phpcs-report/ to learn about why violations are flagged as errors vs warnings and what the levels mean.

Minimal requirements

Installation

To install the VIP Coding Standards, run:

composer config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer require automattic/vipwpcs

or if installing globally:

composer g config allow-plugins.dealerdirect/phpcodesniffer-composer-installer true
composer g require automattic/vipwpcs

This will install the latest compatible versions of PHPCS, PHPCSUtils, PHPCSExtra, WPCS and VariableAnalysis and register the external standards with PHP_CodeSniffer.

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

As of VIPCS version 2.3.0, there is no need to require the PHP_CodeSniffer Standards Composer Installer Plugin anymore as it is now a requirement of VIPCS itself. Permission to run the plugin will still need to be granted though when using Composer 2.2 or higher.

Contribution

Please see CONTRIBUTION.md.

License

Licensed under GPL-2.0-or-later.

OPEN ISSUES

See all