-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Develop pre check #38663
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
Develop pre check #38663
Conversation
.pre-commit-config.yaml
Outdated
- id: check-no-pd-class | ||
name: check for pd class. | ||
types: [python] | ||
entry: pd.testing.assert_series_equal |
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 needs to be pd.testing.* (not exatcly sure how to do the wildcard here). cc @MarcoGorelli
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.
ah I see, thanks for the feed back, I'll update this.
.pre-commit-config.yaml
Outdated
- id: check-no-pd-class | ||
name: check for pd class. | ||
types: [python] | ||
entry: pd.testing. |
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.
suspect need to escape \
the dots
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.
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.
Nice, thanks @cjlynch278 !
Could this fit into the existing non-standard-imports-in-tests
check? Perhaps it could be renamed to check-unwanted-patterns-in-tests
And yes, you'll need to escape dots (pygrep
uses re.search
)
Hey @MarcoGorell and @jreback I added my changes to the existing check, implementing a wildcard. This PR should be ready for final review. In addition, I think a great approach to implementing the pre-commit library would be to not only identify problems like we do now, but to fix them automatically. We can do this using the search and replace plugin - https://github.com/mattlqx/pre-commit-search-and-replace. |
Co-authored-by: Marco Gorelli <[email protected]>
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.
Nice, thanks @cjlynch278 !
* Add the check-no-pd-class hook * make check more generic * change instance of pd.testing in test class * Update .pre-commit-config.yaml * Add wildcard to entry in pre-commit config file * Add check to import test check * Update .pre-commit-config.yaml Co-authored-by: Marco Gorelli <[email protected]> Co-authored-by: Marco Gorelli <[email protected]>
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff