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

Use ruff to detect banned import #57184

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

tqa236
Copy link
Contributor

@tqa236 tqa236 commented Jan 31, 2024

There are several other potential replacement, I just open this PR first to check if this replacement is good or not. The newly added noqa in pandas/io/common.py shows that the check works.

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Jan 31, 2024
@tqa236 tqa236 force-pushed the use-ruff-to-detect-banned-import branch 2 times, most recently from 6fc664e to bb8bc8f Compare February 3, 2024 05:31
@@ -30,6 +30,10 @@ repos:
files: ^pandas
exclude: ^pandas/tests
args: [--select, "ANN001,ANN2", --fix-only, --exit-non-zero-on-fix]
- id: ruff
args: [--exit-non-zero-on-fix, --select=TID251]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cant we just add TID251 to the pyproject.toml?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mroeschke indeed all the TID rules are already enabled. This new hook is redundant because the first ruff hook can cover it already.

Do you think I need to ignore TID251 in pandas/tests/*? If not, this PR should be ready for review

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TID251 shouldn't be ignored for tests

@mroeschke mroeschke added this to the 3.0 milestone Feb 5, 2024
@mroeschke mroeschke merged commit 8a8c408 into pandas-dev:main Feb 5, 2024
51 checks passed
@mroeschke
Copy link
Member

Thanks @tqa236

@tqa236 tqa236 deleted the use-ruff-to-detect-banned-import branch March 17, 2024 07:53
pmhatre1 pushed a commit to pmhatre1/pandas-pmhatre1 that referenced this pull request May 7, 2024
* Use ruff to detect banned import

* Combine rules
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