From 4cb98f1afde48dc1b6956c2fb9cc6124dd5022cd Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Wed, 21 Aug 2013 16:57:57 +1200 Subject: [PATCH] Only have Scrutinizer check PHP files --- .scrutinizer.yml | 2 ++ tests/phpcs_runner.php | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 67c425e2a..dd2b8cd57 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -3,3 +3,5 @@ tools: - scope: file command: php tests/phpcs_runner.php %pathname% + filter: + excluded_paths: ["*/css/*", "css/*", "thirdparty/*", "*/jquery-changetracker/*", "parsers/HTML/BBCodeParser/*", "*/SSTemplateParser.php$"] diff --git a/tests/phpcs_runner.php b/tests/phpcs_runner.php index 43a53dc00..602377e8c 100644 --- a/tests/phpcs_runner.php +++ b/tests/phpcs_runner.php @@ -12,14 +12,18 @@ if(!empty($_SERVER['argv'][1])) { $result = array('comments' => array()); -// Run each sniff +$extension = pathinfo($path, PATHINFO_EXTENSION); -// phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml -run_sniff('tabs.xml', $path, $result); +// Whitelist of extensions to check (default phpcs list) +if(in_array($extension, array('php', 'js', 'inc', 'css'))) { + // Run each sniff -// phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml -run_sniff('ruleset.xml', $path, $result, '--tab-width=4'); + // phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml + run_sniff('tabs.xml', $path, $result); + // phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml + run_sniff('ruleset.xml', $path, $result, '--tab-width=4'); +} echo json_encode($result); function run_sniff($standard, $path, array &$result, $extraFlags = '') {