-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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-bugbear
] Avoid false positive for usage after continue
(B031
)
#10539
[flake8-bugbear
] Avoid false positive for usage after continue
(B031
)
#10539
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.
Looks good, thanks!
flake8-bugbear
] Fix usage count algorithm (B031
)flake8-bugbear
] Avoid false positive for usage after continue
(B031
)
I don't think this is the correct solution as it will not work for nested for _, group in itertools.groupby(...):
use_group(group)
for _ in range(5):
use_group(group) # B031
continue
use_group(group) # B031 This PR stops highlighting the second |
@dhruvmanila - It seems like we're fixing a common false positive but introducing a less common false negative, so it seems like the right tradeoff, unless you disagree? Feel free to file an issue if so. |
Summary
#10337
I've fixed the code to count usage of variable.
Usage count inside the block is reset when there is a following statement.
Test Plan
Add test case.