Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.1

Request #10348 phpcs script should return a value
Submitted: 2007-03-13 05:38 UTC
From: shangxiao Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 0.4.0)
PHP Version: 5.2.1 OS: Irrelevant
Roadmaps: (Not assigned)    

 [2007-03-13 05:38 UTC] shangxiao (David Sanders)
Description: ------------ phpcs should return at least a 1 when it encounters a coding standard error so that it can be used in things like automated pre-commit checks.


 [2007-03-13 20:22 UTC] squiz (Greg Sherwood)
PHP_CodeSniffer was designed to not output anything if no errors are found, and to output a report (that you can use in a cron script or commit message) if errors are found. Have you tried checking for output from the script to determine success or failure?
 [2007-03-14 12:43 UTC] shangxiao (David Sanders)
Checking for a return code is easier and safer than checking for output. Any combination of errors could result in output. It shouldn't be hard to add. (php -l returns 255 if the syntax check fails.)
 [2007-03-14 19:54 UTC] squiz (Greg Sherwood)
> It shouldn't be hard to add. Of course not. Just wanted to suggest an alternative until this feature request is implemented.
 [2007-04-22 05:09 UTC] squiz (Greg Sherwood)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. The phpcs script now exits with a status code. Status 0 is return if no errors or warnings would have been shown. Status 1 is shown if error or warning messages would have been shown. Note that if warnings are found but PHP_CodeSniffer has been told to hide them, an exit status of 0 (success) will be returned if no errors are found.
 [2007-11-04 22:08 UTC] squiz (Greg Sherwood)
Ignore me, I just saw the patch. Missed the email for some reason.