Skip to content

Commit

Permalink
Merge pull request #855 from evilebottnawi/patch-1
Browse files Browse the repository at this point in the history
Support phpcodesniffer-composer-installer for easy integrate code style
  • Loading branch information
JDGrimes authored Jun 30, 2017
2 parents 146666b + e986171 commit 3d15aa6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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).
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 ../../.."
Expand Down

0 comments on commit 3d15aa6

Please sign in to comment.