-
-
Notifications
You must be signed in to change notification settings - Fork 686
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
ENH: Initial configuration to introduce pre-commit #5013
ENH: Initial configuration to introduce pre-commit #5013
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. |
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.
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
Utilities/Maintenance/VCL_ModernizeNaming.py: has a shebang but is not marked executable!
pre-commit hook id: end-of-file-fixer
pre-commit hook id: trailing-whitespace
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. |
@@ -6,7 +6,6 @@ include(${_ITKModuleMacros_DIR}/ITKModuleAPI.cmake) | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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:
|
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 [email protected]
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 -a
PR Checklist
Related to: #4238
Related to: #4565
Related to: #4244