Skip to content
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

added warning if globs are used instead of regex #1707

Merged

Conversation

@paulhfischer
Copy link
Contributor

@paulhfischer paulhfischer commented Nov 21, 2020

resolves #1702

@asottile
Copy link
Member

@asottile asottile commented Nov 22, 2020

it probably makes more sense in pre_commit/clientlib.py? you can probably add a specific validator for this into the cfgv schema for the hook objects

@paulhfischer paulhfischer force-pushed the paulhfischer:warn_on_globs_instead_of_regex branch from 3226922 to fa29a57 Nov 22, 2020
@paulhfischer
Copy link
Contributor Author

@paulhfischer paulhfischer commented Nov 22, 2020

thanks for the hint, i added a validator (+ test) topre_commit/clientlib.py that is applied on config hooks (CONFIG_HOOK_DICT). let me know if you think this is fine or if i should change something.

Copy link
Member

@asottile asottile left a comment

looks great! just a few minor improvements

pre_commit/clientlib.py Outdated Show resolved Hide resolved
pre_commit/clientlib.py Outdated Show resolved Hide resolved
pre_commit/clientlib.py Outdated Show resolved Hide resolved
pre_commit/clientlib.py Outdated Show resolved Hide resolved
tests/clientlib_test.py Outdated Show resolved Hide resolved
tests/clientlib_test.py Outdated Show resolved Hide resolved
@paulhfischer paulhfischer force-pushed the paulhfischer:warn_on_globs_instead_of_regex branch from fa29a57 to 440bbc0 Nov 22, 2020
@paulhfischer paulhfischer marked this pull request as ready for review Nov 22, 2020
@asottile asottile force-pushed the paulhfischer:warn_on_globs_instead_of_regex branch from 440bbc0 to 610716d Nov 23, 2020
Copy link
Member

@asottile asottile left a comment

@asottile asottile merged commit 029f9cc into pre-commit:master Nov 23, 2020
2 checks passed
2 checks passed
pre-commit.ci - pr checks completed successfully
Details
pre-commit.pre-commit #20201123.1 succeeded
Details
@paulhfischer paulhfischer deleted the paulhfischer:warn_on_globs_instead_of_regex branch Nov 23, 2020
@asottile
Copy link
Member

@asottile asottile commented Jan 1, 2021

@paulhfischer do you want to implement this for top-level files / exclude as well? I notice it's missing there :)

@paulhfischer
Copy link
Contributor Author

@paulhfischer paulhfischer commented Jan 1, 2021

ah that's a good idea! i'll add it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants