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

Implement B037 check for yielding or returning values in __init__() #442

Closed r-downing closed 5 months ago

r-downing commented 6 months ago

Implement check for return <value>, yield, yield <value>, or yield from <value> in class __init__() method. No values should be returned or yielded, only bare returns are ok.

These would be runtime errors, if and when these statements are reached.

This does trigger on return None which is equivalent to return, but kind of confusing and pointless to write in a function that shouldn't return anything.

r-downing commented 5 months ago

Waiting on anything else here?