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

[flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH210) #14779

Merged
merged 9 commits into from
Dec 6, 2024

Conversation

InSyncWithFoo
Copy link
Contributor

Summary

Resolves #14441.

Test Plan

cargo nextest run and cargo insta test.

Copy link
Contributor

github-actions bot commented Dec 5, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thanks. The rule seems reasonable to me. I think we should add it to our flake8-use-pathlib category, however. We already have rules such as https://docs.astral.sh/ruff/rules/path-constructor-current-directory/ that tell you how to use pathlib better (rather than just complaining at you if you used os.path instead of pathlib).

@InSyncWithFoo InSyncWithFoo changed the title [ruff] Dotless suffix passed to Path.with_suffix() (RUF049) [flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH901) Dec 5, 2024
@AlexWaygood AlexWaygood self-requested a review December 6, 2024 01:17
@MichaReiser MichaReiser added rule Implementing or modifying a lint rule preview Related to preview mode features labels Dec 6, 2024
Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thank you. A few smaller coding and documentation changes

Copy link
Member

@MichaReiser MichaReiser left a comment

Choose a reason for hiding this comment

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

Thanks, these documentation improvements are great. I now get a good sense for why the fix is unsafe and what the limitations are.

@MichaReiser MichaReiser merged commit 89368a6 into astral-sh:main Dec 6, 2024
21 checks passed
@InSyncWithFoo InSyncWithFoo deleted the RUF049 branch December 6, 2024 12:23
@AlexWaygood AlexWaygood changed the title [flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH901) [flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH210) Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: rule to check an argument of pathlib.Path().with_suffix
3 participants