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
Outputting errors in stderr instead of stdout #37
Comments
You can check for exitCode of process: if any problem found, it will be |
Yeah but by that time it is too late if I want to echo the output to a log file, so if it contains any data the deploy/CI process will stop & output the error. |
Streaming info to stderr does not fit into phpcf interaction model. May be using xml output would be good for this. But, really, you can use exit code to stop CI process after analyzing via phpcf. |
Ok would it be possible to get a json then on stdout (like phpcs offers)? |
Yeah, check out {
"info_messages": [
{
"type": "info",
"message": "Skipping file \/media\/wapmorgan\/HDD\/\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b\/PhpCodeFixer\/tests\/trait.php due to file size limit."
}
],
"problems": [
{
"version": "5.3",
"file": "\/5.3.php",
"line": 3,
"type": "ini",
"checker": "define_syslog_variables"
}
],
"repalces_suggestions": [
{
"type": "function",
"problem": "mcrypt_generic_end()",
"replacement": "mcrypt_generic_deinit()"
}
],
"notes": [
{
"type": "function_usage",
"problem": "piet() (@call_with_passing_by_reference)",
"note": "Call with passing by reference is deprecated. Problem is \"&$hoho\""
}
]
} |
@wapmorgan perfect. Can you include the file path/name in the json too? Also there is a small spelling mistake: repalces_suggestions => replace_suggestions |
@wapmorgan ah sorry, didn't see that bc it looks like version above |
Added |
Thanks |
I just tested this now and it would be nicer if: That would make it really really easy to include in every CI/CD workflow |
bc - is it a program? Which program does not support parsing a json with whitespaces?
What do it for? This makes no sense: when you do new analyze, you need new results. Two json objects on different lines in the same file - is not valid json data. |
Now, If analyzer found any problem, phpcf returns 1 exit code. If you passed Or I didn't understand use-case? |
I already worked around it & got it integrated :-) Anyway the original use case was: |
Would be great if it could output errors on stderr instead of stdout, so phpcf can be in automated deploy pipelines/CI.
e.g.
phpcf myfile >> /dev/null 2>> error.log
Additionally, having the output in json (or at least somewhat configurable) would be great too
The text was updated successfully, but these errors were encountered: