ENH: Add GitHub Actions workflow for running "pre-commit" #1170
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull-request adds workflow leveraging pre-commit, a framework for managing and maintaining pre-commit hooks.
Important
For now, this will only report info to developers after the PR is submitted. There are no changes in the hook setup locally yet.
See https://pre-commit.com/ and https://github.com/pre-commit/action
Running the pre-commit locally can be done using the following
command:
The hooks enabled in the "pre-commit-config.yaml" configuration
file are:
check-added-large-files
Prevent giant files from being committed.
Set the size to 1024 to match the value hard-coded in
https://github.com/Slicer/Slicer/blob/hooks/pre-commit#L125
check-case-conflict
Check for files with names that would conflict on a case-insensitive
filesystem like MacOS HFS+ or Windows FAT.
check-merge-conflict
Check for files that contain merge conflict strings.
check-symlinks
Checks for symlinks which do not point to anything.
To allow a gradual improvement of the code base while carefully reviewing
each changes, exceptions for all issues reported by locally running the
following command are listed in
.flake8
configuration files:It is based from similar updates integrated in Slicer through Slicer/Slicer#6262 themselves adapted from prior work done by @henryiii in https://github.com/scikit-build/scikit-build and https://scikit-hep.org/developer/style