ruff
ruff copied to clipboard
[`flake8-blind-expect`] Allow `raise ... from ex` in `except Exception as ex` in BLE001
Hi,
currently this is allowed in BLE001:
try:
...
except Exception:
raise
But it may be a good idea to allow this format as well (as pylint broad-exception-caught
does):
try:
...
except Exception as ex:
raise ValueError from ex
Thanks in advance!
Yeah, I would say that should be allowed. (There are other rules in Ruff that would then suggest you remove the redundant alias, but on its own it's within the bounds of BLE001
to allow this IMO.)
Thanks!
The variable is only redundant when it is used in raise ex
(TRY201) or in logging.exception()
(TRY401), but in raise ... from ex
it is needed.