-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
add pre-commit config #88
Conversation
Sounds good to me; mark ready-to-review when... you know... and I'll be happy to merge. |
f899845
to
6d23bd7
Compare
I added https://pre-commit.ci/ to my fork, and it now passes on my mirror PR over there: https://github.com/jakkdl/flake8-trio/pull/1 The largest issue was that pyright requires internet connectivity to run, which the pre-commit ci does not support There's a couple options to get around that:
Various other considerations for this, or future PR's, or never:
But otherwise I think this should be good for merging |
rebased on top of main |
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.
Two small actionable comments, then ready to merge!
hooks: | ||
- id: pyright | ||
entry: env PYRIGHT_PYTHON_FORCE_VERSION=latest pyright | ||
args: ['--pythonversion=3.11', '--warnings'] |
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.
I forget the exact syntax here, but we'll want this to run on all-files rather than passing changed filenames, because changing one file can create typecheck errors in another unchanged file.
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.
In the CI check it will run on all files (it runs pre-commit run pyright --all-files
), but I personally prefer the commit hook not to run on all files as that comes with a decently hefty time penalty (5->10 seconds on my machine).
- flake8-builtins | ||
- flake8-bugbear | ||
- flake8-comprehensions | ||
- flake8-2020 | ||
- flake8-bandit | ||
- flake8-builtins | ||
- flake8-bugbear | ||
- flake8-comprehensions | ||
- flake8-datetimez | ||
#- flake8-docstrings | ||
- flake8-mutable | ||
- flake8-noqa | ||
- flake8-pie | ||
- flake8-pytest-style | ||
- flake8-return | ||
- flake8-simplify |
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.
🚀
(makes my pin-your-deps senses tingle, but no worse than the status quo I suppose... I really want better transitive-pins support from pre-commit but it's a pretty big project)
3ced8cc
to
98938ef
Compare
several flake8 plugins pyright is not run with the pre-commit ci, since it requires an internet connection and the free tier for FOSS projects does not allow it. So it's called by tox in a separate GitHub action also fixes several minor style violations reported by those plugins, and adding a few comments
Renamed the |
It bit me a bunch of times that I didn't run tox before pushing minor changes, and
tox -e check
takes 13s on my system, so I've gradually recreated all the functionality from it in pre-commit + some other checks. So at this point it might be worth removingtox -e check
entirely and transitioning the CI to use pre-commit as well. If you approve of the idea I'll implement the necessary gh CI changes as well & clean uptox.ini
.(though it currently won't pass until #87 is merged)TODO: