Repository navigation
Conversation
Assisted by AI Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
Thanks for looking into this! It sounds like this was previously explored/tracked as an expansion to useless-expression (B018), which makes some sense to me. There's even an existing draft PR doing that: #11302. I would probably lean toward reviving that PR and expanding the scope of |
Author
|
Thanks for pointing me at that; I just saw that the rule was unclaimed in the pylint thread, but I agree with the sentiment about near-duplicate rules. I'll take a look at what it would need to see the B018 version to completion. |
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
pointless-string-statement(W0105) rule, after finding some offenses in our own codebase and figuring there would be enough source material to make the fix upstreampointless-string-statementasPLW0105Changes
analyze/suite.rs(same entry point as PYI021) because the exemptions need the previous sibling statementExpectedDocstringKind::Attributesince it was narrower than pylint's exemption (no__init__, noTypeAlias, single-Nametargets only)flake8-bugbearin order to generalizeat_last_top_level_expression_in_cellfor the sake of notebook handling: strings that are a cell's last top-level expression are the cell's displayed output and are exempted, matching B015/B018. The rule runs at suite-analysis time, wherecurrent_statement()isn't populated, so the helper now takes the statement's end offset as a parameter instead. Alternatives to generalizing in-place are duplicating some logic into the pylint rule, or relocating the helper. (Note that B015/B018 behavior is unchanged and their tests were not modified.)Test Plan