PyCQA / flake8-bugbear

A plugin for Flake8 finding likely bugs and design problems in your program. Contains warnings that don't belong in pyflakes and pycodestyle.
MIT License
1.05k stars 103 forks source link

fix(b038): Restrict rule to mutating functions only #453

Closed mimre25 closed 5 months ago

mimre25 commented 5 months ago

Previous implementation produced false positives. This fixes those and adds some more tests.

Fixes #451

@cooperlees this fixes the bugs described in the issue - There are some more mutating functions (like a ~dict.popitem()~ - ok that was an easy one, but = and *= and += are still left to do) that I won't have time to add today. That said, this will only cause false negatives, so I figured I'd push this and create the PR so you can release a fix for the FPs.

mimre25 commented 5 months ago

No worries, I just had an hour in between things just now and this perfectly filled it :slightly_smiling_face:

I will look into a good way to harden it further tomorrow and write up a proposal in an issue then.

mimre25 commented 5 months ago

FYI, I've outlined the proposal on how to harden the rule of B038 further in #454