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
Add types_or #1677
Add types_or #1677
Conversation
e5b7b12
to
b328a3e
Compare
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.
good start!
I believe check_hooks_apply and check_useless_excludes need to be updated
pre_commit/commands/run.py
Outdated
frozenset(types), | ||
frozenset(types_or), | ||
frozenset(exclude_types), | ||
) |
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 should be three separate lines
pre_commit/commands/run.py
Outdated
ret = [] | ||
for filename in names: | ||
tags = self._types_for_file(filename) | ||
if tags >= types and not tags & exclude_types: | ||
if tags >= types and not tags & exclude_types and tags & types_or: |
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.
teeny tiny thing, I'd order the conditions the same as the parameters
hook['types'], | ||
hook['types_or'], | ||
hook['exclude_types'], | ||
) |
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.
""
entry: bin/hook.sh | ||
language: script | ||
types: [file] | ||
types_or: [python, cython] |
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.
these are usually easier to demo with a local repo
I'd probably not write a full integration test for this feature as well but it looks like there maybe aren't great examples using the matcher
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 your feedback, but I'm not sure I understand - are there any existing tests I should look at as examples? If not, I'll try to figure this out, no worries
@@ -0,0 +1,3 @@ | |||
#!/usr/bin/env bash | |||
echo $@ |
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.
~technically this should be echo "$@"
b328a3e
to
62f668f
Compare
Thanks!
Sorry, this isn't clear to me - I updated |
oh maybe I'm wrong, maybe it already works |
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.
closes #607