Add .pre-commit-config.yaml#308
Conversation
Codecov Report
@@ Coverage Diff @@
## main #308 +/- ##
==========================================
- Coverage 95.77% 95.76% -0.02%
==========================================
Files 35 35
Lines 2628 2620 -8
==========================================
- Hits 2517 2509 -8
Misses 111 111
Continue to review full report at Codecov.
|
evamaxfield
left a comment
There was a problem hiding this comment.
Works for me! I probably won't use this personally but I know @AetherUnbound uses pre-commit so you may be the best to say if this is alright or not
toloudis
left a comment
There was a problem hiding this comment.
This looks great. Only minor concern is duplicated settings, that we'd want to change in two places if we ever change them?
yep, if you want to you could make tox.ini and/or the github lint test be: (or just remove them altogether and use pre-commit.ci). This all depends on your preferred workflow as a group though. didn't want to impose on a core part of your CI. |
AetherUnbound
left a comment
There was a problem hiding this comment.
This looks great! Thanks for the contribution 😄 I do support replacing the tox command with pre-commit run --all-files. I've done that in other projects and it's nice to just have one place for lint configuration.
|
If @AetherUnbound says replace tox command with precommit I trust. Would also alleviate @toloudis 's comment on multiple files to change the same configuration. |
|
Side note: because the pre-commit has "rev" tags, does that mean we should get rid of the deps from setup.py? Sorry learning pre-commit here 😅 |
technically, yes, you could remove them entirely from |
|
here's the commit using it for other stuff: 0fef9df |
|
Yea great question @JacksonMaxfield - I also leave them in the dev requirements for the same reason @tlambert03 mentioned! |
|
All sounds good to me! Last note then is that I think we may need to add something to the setup instructions in CONTRIBUTING about setting up pre-commit / installing pre-commit After that, happy to merge 👍 |
|
added a note, but happy to reword or move it!
|
|
Perfect. Thanks! Merged |
Description
This adds a .pre-commit-config.yaml with settings that mimic what's currently in tox.ini
This is opt-in... it doesn't do anything unless you run
pre-commit install. But if you do, then it will add a pre-commit hook to your local git repo make sure that the code you're about to check in will pass linting on CI before checking it in.I stopped short of using this to actually perform the CI, but if you'd like to keep all of your lint settings in one place, I could generally change the linting commands to be
pre-commit run --all-files.also note: with this, you could turn on https://pre-commit.ci/ ... which would run this as a part of PR tests, and would also fix some things automatically for contributors (adding a new commit to the PR).
one more note: as is, this will modify a few errors (like black errors or isort errors) if it finds them, but it won't actually check them in. It will just tell you that there were errors (and prevent you from committing them) and leave the fixes in your unstaged area.
Pull request recommendations:
Thanks for contributing!