-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
pre-commit: code formatter fixes #4415
Conversation
This adds the "no-run-if-empty" flag to the xargs invocation. Otherwise, if git diff names no files, the command is run once with no agument specified which leads to running on a default list of files that appears to include ignored files and files in submodules. I am uneasy about how this works (it means that `pre-commit run --all` doesn't actually check all files) but that's a separate issue.
This isn't right either, because during CI we appear to depend on exactly this behavior to run the formatting at all. |
The build failed at "pre-commit: Have pre-commit pass the list of files to codeformat.py" ( cc1dd73 ) so I added all the changes that the formatter made locally. |
When running from pre-commit, we believe the different invocations of sed were racing with each other, sometimes leaving zero-byte files in the filesystem (ow)
2567bdd
to
d3bf1fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple nitpicks otherwise the changes look good. Thanks!
This adds the "no-run-if-empty" flag to the xargs invocation. Otherwise, if git diff names no files, the command is run once with no agument specified which leads to running on a default list of files that appears to include ignored files and files in submodules.I am uneasy about how this works (it means thatpre-commit run --all
doesn't actually check all files) but that's a separate issue.Change the pre-commit setup so that codeformat.py contains the list of files to run on, according to pre-commit's usual rules