cvs: pear /PHP_CodeSniffer CodeSniffer.php /PHP_CodeSniffer/scripts phpcs

From: Date: Tue, 10 Oct 2006 02:23:15 +0000
Subject: cvs: pear /PHP_CodeSniffer CodeSniffer.php /PHP_CodeSniffer/scripts phpcs
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-42470@lists.php.net to get a copy of this message
squiz Tue Oct 10 02:23:15 2006 UTC Modified files: /pear/PHP_CodeSniffer CodeSniffer.php /pear/PHP_CodeSniffer/scripts phpcs Log: Changed verbose setting to have two levels (-v, -vv), one for progress and one for developer debug (I was gettign sick of debugging the scope map all the time). Also changed the name of the global var to coform with coding standards http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer.php?r1=1.6&r2=1.7&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer.php diff -u pear/PHP_CodeSniffer/CodeSniffer.php:1.6 pear/PHP_CodeSniffer/CodeSniffer.php:1.7 --- pear/PHP_CodeSniffer/CodeSniffer.php:1.6 Wed Oct 4 06:26:41 2006 +++ pear/PHP_CodeSniffer/CodeSniffer.php Tue Oct 10 02:23:14 2006 @@ -107,13 +107,15 @@ /** * Constructs a PHP_CodeSniffer object. * - * @param boolean $verbose Show progress during the script. + * @param int $verbosity The verbosity level. + * 1: Print progress information. + * 2: Print developer debug information. * * @see process() */ - public function __construct($verbose=false) + public function __construct($verbosity=0) { - define('VERBOSE', $verbose); + define('PHP_CODESNIFFER_VERBOSITY', $verbosity); }//end __construct() @@ -152,12 +154,12 @@ $this->_listeners = array(); $this->_files = array(); - if (VERBOSE === true) { + if (PHP_CODESNIFFER_VERBOSITY > 0) { echo 'Registering sniffs... '; } $this->_registerTokenListeners($standard, $sniffs); - if (VERBOSE === true) { + if (PHP_CODESNIFFER_VERBOSITY > 0) { echo "DONE\n"; } @@ -376,7 +378,7 @@ throw new PHP_CodeSniffer_Exception('Source file '.$file.' does not exist'); } - if (VERBOSE === true) { + if (PHP_CODESNIFFER_VERBOSITY > 0) { $startTime = time(); echo 'Processing '.basename($file).' '; } @@ -385,7 +387,7 @@ $this->_files[] = $phpcsFile; $phpcsFile->start(); - if (VERBOSE === true) { + if (PHP_CODESNIFFER_VERBOSITY > 0) { $timeTaken = time() - $startTime; if ($timeTaken === 0) { echo "DONE in < 1 second\n"; @@ -508,7 +510,7 @@ // If verbose output is enabled, we show the results for all files, // but if not, we only show files that had errors or warnings. - if (VERBOSE === true || $numErrors > 0 || ($numWarnings > 0 && $showWarnings === true)) { + if (PHP_CODESNIFFER_VERBOSITY > 0 || $numErrors > 0 || ($numWarnings > 0 && $showWarnings === true)) { $errorFiles[$filename] = array( 'warnings' => $numWarnings, 'errors' => $numErrors, http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/scripts/phpcs?r1=1.3&r2=1.4&diff_format=u Index: pear/PHP_CodeSniffer/scripts/phpcs diff -u pear/PHP_CodeSniffer/scripts/phpcs:1.3 pear/PHP_CodeSniffer/scripts/phpcs:1.4 --- pear/PHP_CodeSniffer/scripts/phpcs:1.3 Sun Oct 1 05:46:04 2006 +++ pear/PHP_CodeSniffer/scripts/phpcs Tue Oct 10 02:23:14 2006 @@ -55,7 +55,7 @@ echo " <standard> : the name of the coding standard to use\n"; echo " <report> : print either the \"full\" or \"summary\" report\n"; echo " -n : do not print warnings\n"; - echo " -v : print verbose output\n"; + echo " -v -vv : print verbose output\n"; echo " -i : show a list of installed coding standards\n"; echo " -h --help : print this help message\n"; echo " --version : print version information\n"; @@ -102,7 +102,7 @@ // The default values for config settings. $files = array(); $standard = NULL; -$verbose = FALSE; +$verbosity = 0; $report = 'full'; $showWarnings = TRUE; @@ -153,7 +153,7 @@ exit(); break; case 'v' : - $verbose = TRUE; + $verbosity++; break; case 'n' : $showWarnings = FALSE; @@ -199,7 +199,7 @@ exit(); } -$phpcs = new PHP_CodeSniffer($verbose); +$phpcs = new PHP_CodeSniffer($verbosity); $phpcs->process($files, $standard); if ($report === 'summary') { $phpcs->printErrorReportSummary($showWarnings);

« previous php.pear.cvs (#42470) next »