moodle/lib/pear/PHP/runsniffer

33 lines
814 B
PHP
Executable File

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