mirror of
https://github.com/WordPress/WordPress-Coding-Standards.git
synced 2025-08-30 03:11:24 +08:00
Merge pull request #855 from evilebottnawi/patch-1
Support phpcodesniffer-composer-installer for easy integrate code style
This commit is contained in:
commit
3d15aa6437
2 changed files with 15 additions and 1 deletions
12
README.md
12
README.md
|
@ -47,7 +47,7 @@ The WordPress Coding Standards are currently [not compatible with the upcoming P
|
||||||
|
|
||||||
### Composer
|
### 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
|
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.
|
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
|
### Standalone
|
||||||
|
|
||||||
1. Install PHP_CodeSniffer by following its [installation instructions](https://github.com/squizlabs/PHP_CodeSniffer#installation) (via Composer, PEAR, or Git checkout).
|
1. Install PHP_CodeSniffer by following its [installation instructions](https://github.com/squizlabs/PHP_CodeSniffer#installation) (via Composer, PEAR, or Git checkout).
|
||||||
|
|
|
@ -13,12 +13,16 @@
|
||||||
"require" : {
|
"require" : {
|
||||||
"squizlabs/php_codesniffer": "^2.9.0"
|
"squizlabs/php_codesniffer": "^2.9.0"
|
||||||
},
|
},
|
||||||
|
"suggest" : {
|
||||||
|
"dealerdirect/phpcodesniffer-composer-installer": "*"
|
||||||
|
},
|
||||||
"minimum-stability" : "RC",
|
"minimum-stability" : "RC",
|
||||||
"support" : {
|
"support" : {
|
||||||
"issues": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues",
|
"issues": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues",
|
||||||
"wiki" : "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki",
|
"wiki" : "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki",
|
||||||
"source": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards"
|
"source": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards"
|
||||||
},
|
},
|
||||||
|
"type" : "phpcodesniffer-standard",
|
||||||
"scripts" : {
|
"scripts" : {
|
||||||
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ../../..",
|
"post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ../../..",
|
||||||
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ../../.."
|
"post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ../../.."
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue