Repository navigation
Adding support for locally-defined hooks - #226
Conversation
There was a problem hiding this comment.
weird, there's a pre-commit hook that should split this line, does this line change when pre-commit run --all-files ? (might be a side-effect of rebase?)
There was a problem hiding this comment.
My bad, I hadn't install pre-commit properly on this repo ! Fixed
b43f776 to
8aa931e
Compare
2 similar comments
There was a problem hiding this comment.
I'd just change these to raise NotImplementedError
There was a problem hiding this comment.
I think you can explicitly include both of those exceptions:
with pytest.raises((jsonschema.exceptions.ValidationError, InvalidConfigError)):
# ...
|
👍 Looks great, address my last couple comments and I'll merge it |
|
Thanks for all your comments ! |
|
I guess one last thing to do will be to update the docs 😄 |
There was a problem hiding this comment.
one last thing (sorry, didn't notice this on the first passes), is there a reason to raise this error? it should just work now that we're doing it at the repository right? (it's a bit silly I agree, but it should work just fine if the check is removed?)
There was a problem hiding this comment.
Yes, but I prefer to be strict at this early stage of config parsing, instead of allowing weird anomalies later.
E.g. if one needs a list of all the local hooks and assume there can be only one entry for them in the config.
Better avoid ambiguity, don't you think ?
There was a problem hiding this comment.
I feel that if it's not broken, why go through the extra trouble to exclude the case?
Also, since hooks run in the order they are defined, it might be desirable to run some hooks out-of-order. We currently don't forbid repeated repos at the moment so I see no reason to make local repos special in that regard.
There was a problem hiding this comment.
Ok, this last argument convinced me. I'm going to remove the check.
2 similar comments
Adding support for locally-defined hooks
|
This has been released as part of 0.5.0 |
|
local hooks are now documented here: http://pre-commit.com/#repository-local-hooks |
Closes #219
All tests pass and coverage for new file
pre_commit/hook_executor.pyis 100%