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
Exit code with diff #325
Comments
I see the exit code is customizable. For some reason I don't have that CLI option.
|
I believe that was reverted. |
Ah, yes, you're right. The question still remains. A 0 exit code on diff seems incorrect, when diff is likely consumed by scripts in most cases. |
I am facing the same issue. As a workaround, I created a wrapper for YAPF which behaves like you described:
|
👍 - it would be much better to customize the exit code for my usage case, or at least exit with something different than 0. this was the behaviour before, no? |
This broken our presubmit style check which expects a non-zero return when there's style problems that need fixing. I think it should operate the same as GNU diff:
|
+1 |
+1 bump Any further thoughts on this? I'd also love to use |
YAPF changed behavior so it no longer returns a non-zero exit code on a diff (see google/yapf#325). This updates the build script so that the build fails if there's a YAPF diff.
YAPF changed behavior so it no longer returns a non-zero exit code on a diff (see google/yapf#325). This updates the build script so that the build fails if there's a YAPF diff.
Hope this can be implemented |
Sorry for leaving this for so long. It looks like there's a general consensus for returning non-zero for a diff. I like the idea of operating as GNU diff does if only for the |
See: To https://github.com/google/yapf Please let me know if this fixes the issue. |
@gwelymernans Works great. Thank you. |
Great! :-) |
yapf 0.17.0 gained a sensible exit code for yapf --diff: - google/yapf#325 - google/yapf@71d9b2e
Diff returns an exit code of 0 regardless. This doesn't seem ideal since CI scripts can no longer rely on a exit code. I would expect diff to return a non-0 if it were to make a change. I understand #228 introduced this change, and I agree a 0 should be returned when making a format change, but running a diff is an entirely different use case, and IMO we should error when the files would be changed.
The text was updated successfully, but these errors were encountered: