flake8-bugbear
flake8-bugbear copied to clipboard
raise RunetimeError check
This is a bit cheeky, but I encountered the misspelling RunetimeError instead of the correct RuntimeError and it seems to have some popularity:
https://github.com/search?l=Python&q=%22raise+RunetimeError%22&type=Code
cc: @timuralp
So are you asking here if we should lint for this? I feel unittests should be finding this one.
Yes, I think bugbear might want to add a check for this and other common typos on exceptional paths. These paths are often hard to test and thus poorly tested. While I have only personally encountered RunetimeError, I could imagine common misspellings of ValueError, OSError, and Exception. We could do some more GitHub searches to prove this out.
In my opinion, this could be better handled by type checking/type hints instead of flake8-bugbear. Those types of tools are expressly designed to trace information like this throughout the application.
Even linters like flake8 can usually detect undefined names like RunetimeError (unless you use import *, but then you have only yourself to blame). I don't think bugbear needs a special case for this.