2009-05-19 15:22:43 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
/**
|
2009-05-20 08:14:38 +00:00
|
|
|
* This script will run PHP CodeSniffer across given Moodle directories and
|
2009-05-20 06:35:46 +00:00
|
|
|
* produce reports of coding standard violations.
|
2009-05-19 15:22:43 +00:00
|
|
|
*
|
2009-05-20 06:35:46 +00:00
|
|
|
* HOW TO USE:
|
|
|
|
* php lib/pear/PHP/runsniffer mod/forum
|
2009-05-20 08:14:38 +00:00
|
|
|
* USEFUL PARAMETERS:
|
|
|
|
* -n : only show ERROR, not WARNING
|
|
|
|
* --report=summary : Outputs a summary instead of a per-file list of errors
|
2009-05-19 15:22:43 +00:00
|
|
|
*
|
2009-05-20 08:14:38 +00:00
|
|
|
* @package lib-pear-PHP-CodeSniffer
|
|
|
|
* @copyright 2009 Nicolas Connault
|
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
2009-05-19 15:22:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
error_reporting(E_ALL | E_STRICT);
|
2009-05-20 10:49:59 +00:00
|
|
|
require_once(dirname(__FILE__).'/../../../config.php');
|
|
|
|
include_once('PHP/CodeSniffer/MoodleCLI.php');
|
2009-05-19 15:22:43 +00:00
|
|
|
|
2009-05-20 08:14:38 +00:00
|
|
|
$phpcs = new moodle_codesniffer_cli();
|
2009-05-19 15:22:43 +00:00
|
|
|
$phpcs->checkRequirements();
|
|
|
|
|
|
|
|
$numErrors = $phpcs->process();
|
|
|
|
if ($numErrors === 0) {
|
|
|
|
exit(0);
|
|
|
|
} else {
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|