Repository navigation
[flake8-bugbear] Report the method name and a more precise range (B005) - #27050
Merged
Merged
Conversation
Viicos
commented
Jul 21, 2026
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| strip-with-multi-characters | 30 | 15 | 15 | 0 | 0 |
The diagnostic message now reports the method name, and range was adapted to be more precise and only cover the call and argument.
Contributor
|
Is this related to an open issue? Changing the range of a rule is almost always a breaking change because it changes where suppression comments work. I have to think about it a bit more, but this does look like an improvement to me. However, we need to make it a preview change, again because it can break suppression comments. |
Contributor
Author
|
I didn't know this would be considered breaking. As such, I opened #27085. |
ntBre
reviewed
Jul 27, 2026
# Conflicts: # crates/ruff_linter/src/preview.rs # crates/ruff_linter/src/rules/flake8_bugbear/rules/strip_with_multi_characters.rs
flake8-bugbear] Report the method name and a more precise range in B005 diagnostics
flake8-bugbear] Report the method name and a more precise range in B005 diagnosticsflake8-bugbear] Report the method name and a more precise range (B005)
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.
The diagnostic message now reports the method name, and range was adapted to be more precise and only
cover the call and argument.
Fixes #27085.
Summary
I got confused by one report of this rule. This is how it looks before this PR:
Test Plan