-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
|
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.
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
)
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.
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
Outdated
Show resolved
Hide resolved
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_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
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.
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
)
Summary
Resolves #14441.
Test Plan
cargo nextest run
andcargo insta test
.