[flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH210)#14779
Merged
MichaReiser merged 9 commits intoastral-sh:mainfrom Dec 6, 2024
Merged
[flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH210)#14779MichaReiser merged 9 commits intoastral-sh:mainfrom
flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH210)#14779MichaReiser merged 9 commits intoastral-sh:mainfrom
Conversation
Contributor
|
AlexWaygood
reviewed
Dec 5, 2024
Member
AlexWaygood
left a comment
There was a problem hiding this comment.
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).
ruff] Dotless suffix passed to Path.with_suffix() (RUF049)flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH901)
MichaReiser
requested changes
Dec 6, 2024
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Thank you. A few smaller coding and documentation changes
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_with_suffix.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_with_suffix.rs
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_with_suffix.rs
Show resolved
Hide resolved
AlexWaygood
reviewed
Dec 6, 2024
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_pathlib_with_suffix.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_pathlib_with_suffix.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_pathlib_with_suffix.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/flake8_use_pathlib/rules/dotless_pathlib_with_suffix.rs
Show resolved
Hide resolved
MichaReiser
approved these changes
Dec 6, 2024
Member
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks, these documentation improvements are great. I now get a good sense for why the fix is unsafe and what the limitations are.
flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH901)flake8-use-pathlib] Dotless suffix passed to Path.with_suffix() (PTH210)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #14441.
Test Plan
cargo nextest runandcargo insta test.