-
Notifications
You must be signed in to change notification settings - Fork 24
feat: check for required git hooks #854
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
Conversation
rokroskar
left a comment
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.
Just a minor wording suggestion in the case of a missing hook template, feel free to ignore if you think it's not necessary to implement.
One thing that comes to mind though - should we run renku doctor automatically every once in a while? The downside is that the the shacl check can be slow. Or maybe we could just suggest to the user periodically to run renku doctor.
| expected_hook = _extract_renku_hook(file_) | ||
|
|
||
| if not expected_hook: | ||
| message = WARNING + 'Cannot check for existence of Git hooks.\n' |
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.
I guess this would happen if the renku installation is somehow corrupted? Maybe we should suggest to reinstall renku?
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.
This was for myself to avoid comparing empty dicts in case the pattern was not parsed correctly :D. This is basically a safety-net for us in case we update the hooks and mess something up so that we see some tests fail. User should never see this and if something is wrong with their renku installation then they probably won't even reach this code.
|
|
||
| if actual_hook != expected_hook: | ||
| message = WARNING + 'Git hooks are outdated or not installed. ' \ | ||
| 'Use "renku githooks install --force" to update them. \n' |
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.
This works nicely!
I am not normally a fan of doing automatic things without users knowing about them. We probably can do this (or ask users to do it) only when there is an update in renku version to make sure that project is compatible with a newer version. I'll create a story for that. |
Description
renku doctorcommand also checks for the existence of the git hooks and checks that their content is up-to-date.Fixes #479