[pylint] Do not report calls when object type and argument type mismatch, remove custom escape handling logic (PLE1310)#15984
Merged
dylwil3 merged 4 commits intoastral-sh:mainfrom Feb 7, 2025
Conversation
Contributor
|
0186a72 to
0e651b1
Compare
dylwil3
requested changes
Feb 6, 2025
crates/ruff_linter/src/rules/pylint/rules/bad_str_strip_call.rs
Outdated
Show resolved
Hide resolved
crates/ruff_linter/src/rules/pylint/rules/bad_str_strip_call.rs
Outdated
Show resolved
Hide resolved
MichaReiser
reviewed
Feb 6, 2025
MichaReiser
reviewed
Feb 6, 2025
0e127ec to
034e3dd
Compare
dylwil3
requested changes
Feb 7, 2025
crates/ruff_linter/src/rules/pylint/rules/bad_str_strip_call.rs
Outdated
Show resolved
Hide resolved
…match, remove custom escape handling logic (`PLE1310`)
7afba27 to
b91ab6b
Compare
MichaReiser
pushed a commit
that referenced
this pull request
Feb 10, 2025
…15985) ## Summary Follow-up to #15984. Previously, `PLE1310` would only report when the object is a literal: ```python 'a'.strip('//') # error foo = '' foo.strip('//') # no error ``` After this change, objects whose type can be inferred to be either `str` or `bytes` will also be reported in preview. ## Test Plan `cargo nextest run` and `cargo insta test`.
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 #15968.
Previously, these would be considered violations:
...while these are not:
Ruff will now not report when the types of the object and that of the argument mismatch, or when there are extra arguments.
Test Plan
cargo nextest runandcargo insta test.