Skip to content

CI, STYLE Consolidate pygrep checks #40782

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

Merged
merged 1 commit into from
Apr 5, 2021

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Apr 5, 2021

These checks can be consolidated using multi-line expressions and verbose regex

I think this should make it easier to extend them, so it should be straightforward to port over the remaining ones in code_checks.sh without having to keep increasing the number of hooks

It also reduces the total number of distinct checks (26 now, down from 31 on master), leading to less visual clutter every time we make a commit

The output will still be clear, as it'll just show the line in which an offending pattern was found. E.g. inserting import conftest into pandas/tests/io/formats/test_info.py results in:

$ pre-commit run unwanted-patterns-in-tests -a
Unwanted patterns in tests...............................................Failed
- hook id: unwanted-patterns-in-tests
- exit code: 1

pandas/tests/io/formats/test_info.py:2:import conftest

@MarcoGorelli MarcoGorelli added the Code Style Code style, linting, code_checks label Apr 5, 2021
@jreback jreback added this to the 1.3 milestone Apr 5, 2021
@jreback jreback merged commit 17c7000 into pandas-dev:master Apr 5, 2021
@jreback
Copy link
Contributor

jreback commented Apr 5, 2021

thanks @MarcoGorelli

@MarcoGorelli MarcoGorelli deleted the consolidate-checks branch April 5, 2021 13:21
vladu pushed a commit to vladu/pandas that referenced this pull request Apr 5, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants