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
command: php tests/phpcs_runner.php %pathname%
filter:
excluded_paths: ["*/css/*", "css/*", "thirdparty/*", "*/jquery-changetracker/*", "parsers/HTML/BBCodeParser/*", "*/SSTemplateParser.php$"]

View File

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