Only have Scrutinizer check PHP files

This commit is contained in:
Simon Welsh 2013-08-21 16:57:57 +12:00
parent 99da5cd198
commit 4cb98f1afd
2 changed files with 11 additions and 5 deletions

View File

@ -3,3 +3,5 @@ tools:
- -
scope: file scope: file
command: php tests/phpcs_runner.php %pathname% command: php tests/phpcs_runner.php %pathname%
filter:
excluded_paths: ["*/css/*", "css/*", "thirdparty/*", "*/jquery-changetracker/*", "parsers/HTML/BBCodeParser/*", "*/SSTemplateParser.php$"]

View File

@ -12,6 +12,10 @@ if(!empty($_SERVER['argv'][1])) {
$result = array('comments' => array()); $result = array('comments' => array());
$extension = pathinfo($path, PATHINFO_EXTENSION);
// Whitelist of extensions to check (default phpcs list)
if(in_array($extension, array('php', 'js', 'inc', 'css'))) {
// Run each sniff // Run each sniff
// phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml // phpcs --encoding=utf-8 --standard=framework/tests/phpcs/tabs.xml
@ -19,7 +23,7 @@ run_sniff('tabs.xml', $path, $result);
// phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml // phpcs --encoding=utf-8 --tab-width=4 --standard=framework/tests/phpcs/ruleset.xml
run_sniff('ruleset.xml', $path, $result, '--tab-width=4'); run_sniff('ruleset.xml', $path, $result, '--tab-width=4');
}
echo json_encode($result); echo json_encode($result);
function run_sniff($standard, $path, array &$result, $extraFlags = '') { function run_sniff($standard, $path, array &$result, $extraFlags = '') {