Open
Description
Many non-ad-hoc (pre-commit) hooks seem just to get the error code and parse stdout using extract_messages
with the right MESSAGE_REGEX
and MESSAGE_TYPE_CATEGORIZER
.
Ad-hoc hooks could be taught how to do that from the overcommit YAML config file using:
- one regex for the message (a good default being the Emacs format)
- one optional regex to test whether the message is a warning or an error ("warning:" seems pretty common)
- maybe one optional regex to prefilter lines (empty lines, non-standard line, etc.), and flags to capture stdout and/or stderr, if we really need or want to handle more cases
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?