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 = '') {