ENH: Initial configuration to introduce pre-commit#5013
ENH: Initial configuration to introduce pre-commit#5013hjmjohnson merged 13 commits intoInsightSoftwareConsortium:masterfrom
Conversation
12ddb0c to
1729522
Compare
|
I made an upstream pull request for Kitware's GitSetup to support precommit to avoid the code duplication: Also in #4651 I started to use clang-format into pre-commit. Sometimes with big rebases and commit the large number of recommit checks is slower, so perhaps there can be too many checks. However I have found the precommit file easier to maintain. |
Pre-commit is tremendously easier to maintain. I don't think the performance concerns are that disruptive. |
jhlegarreta
left a comment
There was a problem hiding this comment.
Thanks for doing this Hans.
Have not tried locally.
A few comments:
-
Should this file be deleted?
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/GitSetup/setup-hooks -
Should these lines be removed:
https://github.com/InsightSoftwareConsortium/ITK/blob/master/Utilities/GitSetup/config#L1-L2 -
Not sure if I understand the passage "Using a temporary repo to hold Kitware hooks with a configuration for pre-commit.". Which is the temporary repository?
Yes, I agree it's likely worth the switch. Just need to consider ways to reduce code duplication etc. |
2beb005 to
00d1248
Compare
13ddc1c to
a117d80
Compare
Remove the cmake based custom download and running of clang-format with shell scripting. Prefer the more robust and easier to maintain pre-commit clang-format instrumentation.
4c32da8 to
8b99c00
Compare
|
@dzenanz @blowekamp This should be ready for final reviews now. I have it working on my Mac, and older testing that I think is the same, worked on windows and linux. |
| include(${_ITKModuleMacros_DIR}/ITKModuleDoxygen.cmake) | ||
| include(${_ITKModuleMacros_DIR}/ITKModuleHeaderTest.cmake) | ||
| include(${_ITKModuleMacros_DIR}/ITKModuleKWStyleTest.cmake) | ||
| include(${_ITKModuleMacros_DIR}/ITKModuleClangFormat.cmake) |
There was a problem hiding this comment.
@N-Dekker Ahh, with this commit, we will not be required to "know" about existence of clang-format. Except for use in IDEs, such as Visual Studio 😄
|
I just encountered an issue with updating ThirdParty libraries and the precommit setup: |
Following InsightSoftwareConsortium/ITK#5013. Done with: find -name '*py' -exec dos2unix {} \; find -name '*py' -exec black {} \; find -name '*py' -exec git add {} \;
Following InsightSoftwareConsortium/ITK#5013. Done with: find -name '*py' -exec dos2unix {} \; find -name '*py' -exec black {} \; find -name '*py' -exec git add {} \;
Following InsightSoftwareConsortium/ITK#5013. Done with: find -name '*py' -exec dos2unix {} \; find -name '*py' -exec black {} \; find -name '*py' -exec git add {} \;
Update SetupForDevelopment to setup pre-commit
Using a temporary repo to hold Kitware hooks with a configuration for
pre-commit. Replaces the system to clone the hook repo/branch into the
.git/hooks directory, which just using pre-commit.
This PR mirrors work from SimpleITK performed by
Bradley Lowekamp blowekamp@mail.nih.gov
The pre-commit python virtual environment can be manually
loaded with: source .git/hooks/venv/bin/activate
which would allow using the pre-commit command prior to
doing an actual commit.
i.e.
source .git/hooks/venv/bin/activate pre-commit run -aPR Checklist
Related to: #4238
Related to: #4565
Related to: #4244