-
Notifications
You must be signed in to change notification settings - Fork 107
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
B038 false positives #455
Comments
cc @mimre25. I think we can fix this by making the rule not trigger if the mutation is unconditionally followed by a |
Oh this is good one. I think excluding mutations that are followed by a break (unconditionally) sounds like a good fix. Should I loop this into #454 ? |
I also found an issue when iterating over a Therefore I propose to make this rule optional. |
Oh my... with all those false positives stemming from the standard lib, I also think it's best to make the rule optional. What do you think @JelleZijlstra @cooperlees? |
I'll accept the PR if we all feel we should move this to a B9XX optional due to our learning here. Thanks all! |
B038 lead to some false positives that stem from methods defined in the standard library that have the same name as mutating functions for container types like lists and dicts. Thus we decided to make this rule optional. See PyCQA#455 for the related discussion.
B038 lead to some false positives that stem from methods defined in the standard library that have the same name as mutating functions for container types like lists and dicts. Thus we decided to make this rule optional. See #455 for the related discussion.
having the following code;
bugbear badly detects B038.
Sample: https://doc.wikimedia.org/pywikibot/master/_modules/proofreadpage.html#ProofreadPage
in index property (search for
def index
). As B038 is descibed as Found a mutation of a mutable loop iterable inside the loop body. Changes to the iterable of a loop such as calls to list.remove() or via del can cause unintended bugs. This rule should be an optionated warning instead of a general rule.The text was updated successfully, but these errors were encountered: