-
Notifications
You must be signed in to change notification settings - Fork 134
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
Configure pre-commit and pre-commit CI #1286
Conversation
for more information, see https://pre-commit.ci
Converted to draft (waiting on outcome of #1283) |
Is this something that would be welcome in Parcels? If so, should we add |
I think the option of using the pre-commit workflow is nice! I just tried it and it works smoothly. So yes, let's add |
Happy to do so. Will do it within the hour |
Should I also remove the flake8 workflow @erikvansebille ? If we're using pre-commit CI, then we'd have doubleup with the flake8 linting (GitHub actions + precommit CI) |
Pre-commit and pre-commit CI allow for the quick and seamless detection (and in some cases auto-fixing) of various code quality issues (aka. pre-commit hooks, full list here).
If precommit is to be used locally:
pre-commit
from PYPI/Conda-forge (pip install pre-commit
, orconda install -c conda-forge pre-commit
)pre-commit install
to set up the hooks listed in.pre-commit-config.yaml
Now when you commit, the hooks will be run before the commit is executed (aborting the commit if the hooks pick up errors they can't autofix).
For pre-commit CI, once configured it works automatically on PRs using the same
.pre-commit-config.yaml
. It commits to the branch for automatic fixes, and gives informative logs for changes it can't autofix.This pre-commit workflow would replace GitHub actions for linting workflows.
Current hooks:
Potential additional hooks:
Configuration of pre-commit CI:
Fixes #1285