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
yapf -i and pass pre-commit check #747
Comments
pre-commit itself will never touch the staging area. These are good ways to silently break commits. In my mind this is one of the worst things that lint-staged does and suggests -- hooks are very frequently not perfect and magically changing what's being committed should not be taken lightly. That said, if you would like to foot gun, your hook can call - id: yapf
entry: bash -c 'yapf "$@"; git add -u' -- (note: using bash will potentially reduce portability) |
Thanks for the tip! It doesn’t have to be a foot gun. For example Black can compare the AST before/after if one is untrustful for some reason. And there can always be checks at the CI level. |
It seems that in #285 you made it so that when a tool like
yapf
formats code inlinepre-commit
will always mark the check as failed, because files were changed. Is this correct?If so, funnily enough the behaviour I'm looking for is the exact thing you felt was a "fix". I'd like this to be able to pass:
I suppose that would require pre-commit to stage the auto formatted changes automatically too.
Any chance of supporting this? Its how
pretty-quick
works for example.The text was updated successfully, but these errors were encountered: