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.06k stars 104 forks source link

refactor(b038): Cleanup unused code in B038Checker #448

Closed mimre25 closed 8 months ago

mimre25 commented 8 months ago

The unused code would introduce a bug when used, thus I believe it's better to remove it.

Essentially, it would've flagged any del statement within a loop, without check for the name. However, because the B038Checker visits Del nodes, and doesn't call generic_visit from there, we'll never reach a Name node that has the ctx == Del.

I've added a test case, just to make sure :slightly_smiling_face: