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

From: Date: Sun, 22 Apr 2007 05:07:39 +0000
Subject: cvs: pear /PHP_CodeSniffer CodeSniffer.php package.xml /PHP_CodeSniffer/scripts phpcs
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-46099@lists.php.net to get a copy of this message
squiz Sun Apr 22 05:07:39 2007 UTC Modified files: /pear/PHP_CodeSniffer CodeSniffer.php package.xml /pear/PHP_CodeSniffer/scripts phpcs Log: phpcs now exits with status 0 (no errors) or 1 (errors found) (feature request #10348) http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/CodeSniffer.php?r1=1.25&r2=1.26&diff_format=u Index: pear/PHP_CodeSniffer/CodeSniffer.php diff -u pear/PHP_CodeSniffer/CodeSniffer.php:1.25 pear/PHP_CodeSniffer/CodeSniffer.php:1.26 --- pear/PHP_CodeSniffer/CodeSniffer.php:1.25 Sun Apr 22 04:32:33 2007 +++ pear/PHP_CodeSniffer/CodeSniffer.php Sun Apr 22 05:07:39 2007 @@ -11,7 +11,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: CodeSniffer.php,v 1.25 2007/04/22 04:32:33 squiz Exp $ + * @version CVS: $Id: CodeSniffer.php,v 1.26 2007/04/22 05:07:39 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -403,10 +403,12 @@ * * @param boolean $showWarnings Show warnings as well as errors. * - * @return void + * @return int The number of error and warning messages shown. */ public function printErrorReport($showWarnings=true) { + $errorsShown = 0; + foreach ($this->_files as $file) { $warnings = $file->getWarnings(); $errors = $file->getErrors(); @@ -517,6 +519,7 @@ } echo ' | '.$errorMsg.PHP_EOL; + $errorsShown++; } }//end foreach @@ -524,6 +527,8 @@ }//end foreach + return $errorsShown; + }//end printErrorReport() @@ -536,7 +541,7 @@ * * @param boolean $showWarnings Show warnings as well as errors. * - * @return void + * @return int The number of error and warning messages shown. */ public function printErrorReportSummary($showWarnings=true) { @@ -559,7 +564,7 @@ if (empty($errorFiles) === true) { // Nothing to print. - return; + return 0; } echo PHP_EOL.'PHP CODE SNIFFER REPORT SUMMARY'.PHP_EOL; @@ -611,6 +616,8 @@ echo "WERE FOUND IN $totalFiles FILE(S)".PHP_EOL; echo str_repeat('-', 80).PHP_EOL.PHP_EOL; + return ($totalErrors + $totalWarnings); + }//end printErrorReportSummary() http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/package.xml?r1=1.56&r2=1.57&diff_format=u Index: pear/PHP_CodeSniffer/package.xml diff -u pear/PHP_CodeSniffer/package.xml:1.56 pear/PHP_CodeSniffer/package.xml:1.57 --- pear/PHP_CodeSniffer/package.xml:1.56 Sun Apr 22 04:32:33 2007 +++ pear/PHP_CodeSniffer/package.xml Sun Apr 22 05:07:39 2007 @@ -23,8 +23,8 @@ <date>2007-04-17</date> <time>13:13:21</time> <version> - <release>0.5.0</release> - <api>0.5.1</api> + <release>0.6.0</release> + <api>0.6.0</api> </version> <stability> <release>beta</release> @@ -37,6 +37,7 @@ - Thanks to Carsten Wiedmann for the patch. - Now using PHP_EOL instead of hard-coded \n so output looks good on Windows (feature request #10761) - Thanks to Carsten Wiedmann for the patch. + - phpcs now exits with status 0 (no errors) or 1 (errors found) (feature request #10348) </notes> <contents> <dir name="/"> http://cvs.php.net/viewvc.cgi/pear/PHP_CodeSniffer/scripts/phpcs?r1=1.11&r2=1.12&diff_format=u Index: pear/PHP_CodeSniffer/scripts/phpcs diff -u pear/PHP_CodeSniffer/scripts/phpcs:1.11 pear/PHP_CodeSniffer/scripts/phpcs:1.12 --- pear/PHP_CodeSniffer/scripts/phpcs:1.11 Sun Feb 18 22:35:53 2007 +++ pear/PHP_CodeSniffer/scripts/phpcs Sun Apr 22 05:07:39 2007 @@ -12,7 +12,7 @@ * @author Marc McIntyre <mmcintyre@squiz.net> * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600) * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence - * @version CVS: $Id: phpcs,v 1.11 2007/02/18 22:35:53 squiz Exp $ + * @version CVS: $Id: phpcs,v 1.12 2007/04/22 05:07:39 squiz Exp $ * @link http://pear.php.net/package/PHP_CodeSniffer */ @@ -202,9 +202,15 @@ $phpcs->process($files, $standard); if ($report === 'summary') { - $phpcs->printErrorReportSummary($showWarnings); + $numErrors = $phpcs->printErrorReportSummary($showWarnings); } else { - $phpcs->printErrorReport($showWarnings); + $numErrors = $phpcs->printErrorReport($showWarnings); +} + +if ($numErrors === 0) { + exit(0); +} else { + exit(1); } ?>

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