From 14a198a3cb7e6d98e84b5dc450db8fad34194a83 Mon Sep 17 00:00:00 2001 From: Evilebot Tnawi Date: Mon, 27 Feb 2017 17:31:24 +0300 Subject: [PATCH 1/2] Support phpcodesniffer-composer-installer for easy integrate code style https://github.com/DealerDirect/phpcodesniffer-composer-installer --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 121cdd21..9f9a42cb 100644 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ "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 ../../.." From e986171c4a254ecfe7dbb2f887c4ac6d38cad446 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 30 Jun 2017 00:58:55 +0200 Subject: [PATCH 2/2] Composer: suggest composer plugin & update README Fixes the open actions for PR 855. --- README.md | 12 +++++++++++- composer.json | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a749871f..7a473f14 100644 --- a/README.md +++ b/README.md @@ -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 convenience of using `phpcs` as global command you might want to add path to `wpcs/vendor/bin` directory to a `PATH` environment of 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). diff --git a/composer.json b/composer.json index 9f9a42cb..a26ee8b5 100644 --- a/composer.json +++ b/composer.json @@ -13,6 +13,9 @@ "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",