Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork120
Use pre-commit for linting#607
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
all the line endings have changed in this file; there are no other changes
I think this is fine for linting steps that don't attempt to import typing-extensions. It's more important for unit tests. |
This PR adds a pre-commit-config file to the repo and removes our linting GitHub Actions workflow. It shouldn't be merged unless we:
a. Enable pre-commit.ci on this repo or
b. Replace the GitHub Actions workflow with one that useshttps://github.com/pre-commit/action
My main motivation for proposing this change is that there are various linting tools that I think would be useful for this project that exist conveniently as pre-commit hooks, and which can be run easily in isolated environments via pre-commit. There are actually several other tools that I'd like to add (zizmor, a security linter, would be very relevant here, I think) but which have several complaints on the repo as-is -- if this is accepted, I'll add them in followup PRs so it's easy to identify exactly why we're making each change.
The downside of this change is that we're once again using tools written in Python to lint this repo. pre-commit doesn't currently appear to have a direct or indirect dependency on typing_extensions, but that could easily change in the future. It's fairly easy to simply run pre-commit using uv or pipx to ensure that pre-commit itself is installed into a standalone virtual environment, but this does require a little bit more explanation in our CONTRIBUTING guide.