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
ci: Add pre-commit configs #215
Conversation
9156284
to
dc3c37c
Compare
Resolves #199 **Why this change was necessary** We want to enforce file size limits on commits to ensure contributors don't accidentally commit massive files to the repo and pollute the history. This should be checked both locally and on GitHub. **What this change does** - Adds `pre-commit` as an optional `dev` dependency - Adds `pre-commit` hooks for YAML check, merge conflict string check, AST check, and large file (>500kb) check - Adds GitHub Action to run above pre-commit checks on each PR and push to master - Updates documentation to instruct contributors to install `dev` dependencies **Additional context/notes/links** - https://github.com/pre-commit/pre-commit-hooks#check-added-large-files - https://pre-commit.com
dc3c37c
to
56df624
Compare
Are the local hooks always run when we locally commit something or we need to manually run pre-commit to check? |
Once the project has been reinstalled with |
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.
Awesome, I'm scared to test it but if you have then it LGTM!
@shimming-toolbox/editors once this PR is closed, please run |
Cross-referencing the related issues on sister projects to get that sweet, sweet GH auto-linking UI magic: |
Resolves #199 **Why this change was necessary** We want to enforce file size limits on commits to ensure contributors don't accidentally commit massive files to the repo and pollute the history. This should be checked both locally and on GitHub. **What this change does** - Adds `pre-commit` as an optional `dev` dependency - Adds `pre-commit` hooks for YAML check, merge conflict string check, AST check, and large file (>500kb) check - Adds GitHub Action to run above pre-commit checks on each PR and push to master - Updates documentation to instruct contributors to install `dev` dependencies **Additional context/notes/links** - https://github.com/pre-commit/pre-commit-hooks#check-added-large-files - https://pre-commit.com
Inspired by this PR, we're implementing the same feature in another sister project (AxonDeepSeg) see here. The pre-commit hook in this PR requires the developer/contributor to do the mandatory step There might be instances where the developer might forget this step and this would lead to the checks being skipped locally. In order to avoid this, for this, in the PR axondeepseg/axondeepseg#464, we are thinking to do add I wish to know did you consider this option for installing pre-commit hooks?
|
I actually didn't know this was an option! It looks like it's viable, with the only caveat that it creates a bit of dependence on setup.py magic. Just remember to attempt triggering it only if the |
Thanks @jidicula for your valuable inputs. |
Checklist
Description
Why this change was necessary
We want to enforce file size limits on commits to ensure contributors
don't accidentally commit massive files to the repo and pollute the
history. This should be checked both locally and on GitHub.
What this change does
pre-commit
as an optionaldev
dependencypre-commit
hooks for YAML check, merge conflict stringcheck, AST check, and large file (>500kb) check
push to master
dev
dependenciesAdditional context/notes/links
Linked issues
Resolves #199