-
Notifications
You must be signed in to change notification settings - Fork 280
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
Teach ad-hoc hooks line-parsing using regexes in YAML #750
Comments
Supportive of reducing the friction to integration a separate executable/script with Overcommits line handling functionality. Pull request with tests welcome! |
OK, thanks for confirming! Another question: is there a good reason why built-in hooks could not "be ad-hoc" like plugin hooks? As regards more targeted unit testing I cannot find an existing unit test which exercise the class(es) I want to modify: only So would only indirect testing as outlined above be fine? |
I could see many built-in hooks converted to the ad hoc format, yes. I haven't considered the implications too deeply, however, but would be open to a proposal. Perhaps we can reduce complexity while still bringing value by decoupling of rewriting existing hooks from the adding of support for built-in hooks to use an ad hoc format. |
Not sure I will follow up on this, I am mostly interested in tools that overcommit still does not support! 😛
Yeah, I came to the same conclusion, and finally found a way to test at least some of the new code using rspec while implementing it. However I also uncovered one glaring bug only after using it for real, while integrating a tool not yet supported by overcommit (to test my own changes in overcommit). I guess that integration may warrant a separate PR, I'll do at least separate commits for now. I still need to cleanup the code (still a few Rubocop violations) and finish the doc. |
See #757! |
Many non-ad-hoc (pre-commit) hooks seem just to get the error code and parse stdout using
extract_messages
with the rightMESSAGE_REGEX
andMESSAGE_TYPE_CATEGORIZER
.Ad-hoc hooks could be taught how to do that from the overcommit YAML config file using:
Of course I guess in the end it all boils down to whether one prefers Ruby to regexes! 😉
Anyway this might still be a good alternative for non-Ruby programmers to easily contribute hooks, and a good way to write less code (although I am not sure yet how tests could be written).
Thoughts?
The text was updated successfully, but these errors were encountered: