-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
docs: add suggested pre-commit config #16771
base: main
Are you sure you want to change the base?
Conversation
[ci skip-rust] [ci skip-build-wheels]
b6a5faa
to
d72ece1
Compare
Question on this: Is this for use cases where pre-commit is already in use for the repo? |
Yeah that was the intention
No, perhaps we should add this. That would be a more natural place for this than CI docs. We could mention hand-rolling hooks like you described or using tools like pre-commit dot com as well. Mostly I want to highlight the gotchyas around using the |
Btw, how do I add a category label? Is that a right given only to maintainers? |
Contributors can as well: I'll ping you about that offline. |
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.
Thanks!
|
||
To allow developers to check code before committing or pushing, you can supply a [pre-commit](https://pre-commit.com/) hook that will run Pants commands before. This can help have a faster feedback loop and reduce load and cost on your CI systems. | ||
|
||
However, using `--changed-since=origin/main` is not as useful locally. Developers my have unstaged or untracked files lying around in their working directory, or their Git references may be out of date or named differently than the ones you use in CI. Instead, it's better to leverage pre-commit's ability to pass changed filenames to commands to Pants, and tell Pants to ignore files it's been told not to track: |
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.
However, using `--changed-since=origin/main` is not as useful locally. Developers my have unstaged or untracked files lying around in their working directory, or their Git references may be out of date or named differently than the ones you use in CI. Instead, it's better to leverage pre-commit's ability to pass changed filenames to commands to Pants, and tell Pants to ignore files it's been told not to track: | |
However, using `--changed-since=origin/main` is not as useful locally. Developers my have unstaged or untracked files lying around in their working directory, or their Git references may be out of date or named differently than the ones you use in CI. Instead, it's often better to leverage pre-commit's ability to pass changed filenames to commands to Pants, and tell Pants to ignore files it's been told not to track: |
Using with pre-commit | ||
--------------------- |
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.
This means H2, and it makes the H3 for "### Tuning resource consumption (advanced)" in the wrong place. Maybe keep it as H2 but move to lower in the file?
Adds a section describing a possible working pre-commit config, using pass_filenames and
--unmatched-cli-globs=ignore