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

Request #17467 Do not ouput report, if argument report-file is given
Submitted: 2010-06-04 22:37 UTC
From: valgard Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.2.2)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2010-06-04 22:37 UTC] valgard (Sven Pöche)
Description: ------------ CodeSniffer should not ouput the report, if the command line argument report-file is given. Change line 99 of Reporting.php from ob_end_flush(); to ob_end_clean();

Comments

 [2010-06-05 04:09 UTC] squiz (Greg Sherwood)
-Assigned To: +Assigned To: squiz
This is by design and useful in some continuous integration environments so you can see errors and notices raised by PHP_CodeSniffer. I'll leave it as a feature if I ever decide to make a command line switch for it.
 [2010-07-21 01:22 UTC] benmatselby (Ben Selby)
 [2010-07-21 01:24 UTC] benmatselby (Ben Selby)
Greg, I've added a -d flag that turns off the output if you use it with --report-file.. I've also now started to create some phpt tests to cover off the UI aspect of the application - hope you can use these and agree with the structure. If not let me know as I am happy to change if need be, but they help out with these kinds of unit tests.
 [2010-07-23 22:35 UTC] benmatselby (Ben Selby)
After thinking about this I think the option should be called -m for mute rather than -d as that seems like obvious choice if you wanted an option to override php settings such as memory_limit. If you think you can use this patch and would rather use -m let me know and I will update
 [2010-07-26 20:09 UTC] benmatselby (Ben Selby)
 [2010-07-26 20:11 UTC] benmatselby (Ben Selby)
Updated as -m (mute) so we can use -d for #17244..
 [2010-08-06 08:51 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
I decided to do this in a different way as I didn't want another command line argument for something that may be rarely used. So what I did is change the default behaviour to NOT print the report to screen. If you specify the -v command line argument, the report will be printed to screen as well. Sven, I think you are right that users would expect it to not print to screen, but if you use -v, you are expecting more output to come to the screen, so it's probably not a massive surprise that it gets printed. And when used in CI environments, adding -v to the end actually gives you some additional useful output about registered sniffs and is easy to do.