-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CLI argument to quiet PHPCS output #969
Comments
I don't get any time output for the JSON report. The only time PHPCS is ever going to print runtime info for a JSON report should be when either:
Do you have progress information set to print in your phpcs.xml file by any chance? Can you remove that from your linter's settings? |
Yes, you're right, I have The behavior is still inconsistent depending on whether errors were found, but I can't complain too much that progress information is provided if the config asks for it, so this is probably invalid-ish. |
The reason it seems this way is that the error reports themselves decide if the run time information should be printed, and where it should be printed. The reports typically used in build systems (json, xml, checkstyle etc) don't print any run time info. When you are asking for progress information to be printed to the screen, you've already got a chunk of content that can't be consumed properly by a build system. So in this case, PHPCS shows the run time information so there is no chance of the script just exiting without any report output. Ideally, what you want is for the linter to be using a standard that doesn't show any progress information at all, so the report is the only thing that is ever produced. Currently, the only way to do this (if you want to keep the progress info in your phpcs.xml file) is to specify a different standard file that includes the same rules but doesn't include the progress flag. One way around this might be to add a Obviously, this isn't going to help you until a future PHPCS release and a future linter release, but I think I'll still put it on the todo because I'm sure it will be helpful in the future. I'm going to turn this report into a feature request for a quiet flag and it seems you've got a workaround for now. |
…information from being printed (request #969)
I've added the |
When I run
phpcs --report=json
and it finds errors, it simply outputs{JSON here}
and nothing else. However, if it finds no errors, it outputs{JSON here}Time: 97ms; Memory: 6Mb
which is not valid JSON. Other tools that consume phpcs output (thelinter-phpcs
plugin in Atom in my case) choke on this.I think this may have been broken by d4abee4; #335 indicates this information previously wasn't printed when no errors were found.
The text was updated successfully, but these errors were encountered: