From 1999eb3879621b562abb43c0d112fac79db623e1 Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Tue, 6 Jan 2015 10:47:25 -0800 Subject: [PATCH] Add composer lint, phpcs, and test commands lint uses jakub-onderka/php-parallel-lint to check the syntax of the provided PHP files or directories. phpcs uses the MediaWiki codesniffer standard to check the provided files or directories. test runs both lint and phpcs together. phpunit is not included at this time because our phpunit tests require a database to be set up and are very very slow. Example usage: composer lint . # Lint all files composer phpcs includes/FooBar.php # Check code style of one file composer test extensions/FooBar # Lint and check an extension Change-Id: I3c7ac7a02668776de6400ac268f37e7e6b35a3c6 --- composer.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a289446a5b..11520efa11 100644 --- a/composer.json +++ b/composer.json @@ -27,8 +27,10 @@ "zordius/lightncandy": "0.18" }, "require-dev": { + "jakub-onderka/php-parallel-lint": "~0.8", "justinrainbow/json-schema": "~1.3", - "phpunit/phpunit": "~4.5" + "phpunit/phpunit": "~4.5", + "mediawiki/mediawiki-codesniffer": "0.1.0" }, "suggest": { "ext-fileinfo": "*", @@ -44,6 +46,12 @@ } }, "scripts": { + "lint": "parallel-lint --exclude vendor", + "phpcs": "phpcs $PHPCS_ARGS -s --standard=vendor/mediawiki/mediawiki-codesniffer/MediaWiki --ignore=vendor --encoding=utf-8 --extensions=php,php5,inc,sample", + "test": [ + "composer lint", + "composer phpcs" + ], "pre-update-cmd": "ComposerHookHandler::onPreUpdate", "pre-install-cmd": "ComposerHookHandler::onPreInstall" }, -- 2.20.1