Merge pull request #855 from evilebottnawi/patch-1

Support phpcodesniffer-composer-installer for easy integrate code style
This commit is contained in:
J.D. Grimes 2017-06-30 08:31:08 -04:00 committed by GitHub
commit 3d15aa6437
2 changed files with 15 additions and 1 deletions

View file

@ -47,7 +47,7 @@ The WordPress Coding Standards are currently [not compatible with the upcoming P
### Composer
Standards can be installed with [Composer](https://getcomposer.org/) dependency manager:
Standards can be installed with the [Composer](https://getcomposer.org/) dependency manager:
composer create-project wp-coding-standards/wpcs --no-dev
@ -60,6 +60,16 @@ Running this command will:
For the convenience of using `phpcs` as a global command, you may want to add the `wpcs/vendor/bin` path to a PATH environment in your operating system.
#### Installing WPCS as a dependency
When installing the WordPress Coding Standards as a dependency in a larger project, the above mentioned step 3 will not be executed automatically.
There are two actively maintained Composer plugins which can handle the registration of standards with PHP_CodeSniffer for you:
* [composer-phpcodesniffer-standards-plugin](https://github.com/higidi/composer-phpcodesniffer-standards-plugin)
* [phpcodesniffer-composer-installer](https://github.com/DealerDirect/phpcodesniffer-composer-installer)
It is strongly suggested to `require` one of these plugins in your project to handle the registration of external standards with PHPCS for you.
### Standalone
1. Install PHP_CodeSniffer by following its [installation instructions](https://github.com/squizlabs/PHP_CodeSniffer#installation) (via Composer, PEAR, or Git checkout).

View file

@ -13,12 +13,16 @@
"require" : {
"squizlabs/php_codesniffer": "^2.9.0"
},
"suggest" : {
"dealerdirect/phpcodesniffer-composer-installer": "*"
},
"minimum-stability" : "RC",
"support" : {
"issues": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues",
"wiki" : "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki",
"source": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards"
},
"type" : "phpcodesniffer-standard",
"scripts" : {
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ../../..",
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ../../.."