Ruff should detect unreachable code but reports 'Missing explicit return', fixing it with return None
#6334
Labels
bug
Something isn't working
return None
#6334
In the code below Ruff should detect unreachable code, but it reports 'Missing explicit return'.
It tries to
--fix
the problem appending areturn None
line even after the unreachable code, which clearly makes no sense.Example
After running
ruff foo.py --fix
you get:return foobar_rates rates = rates.reset_index() + return None
Interestingly, with
ruff foo.py --fix --isolated
nothing gets changed.Ruff details
Configuration in
pyproject.toml
:Maybe related
I found PR #5384, which seems to address the very issue. Interestingly, the configuration rule
RUF014
that the PR supposedly implements is not mentioned in any of the recent releases. (I tried to install Ruff from source code to verify the claim of the merged feature not being included, but my system ships a too-old version ofrustc
, which makes the build fail.)The text was updated successfully, but these errors were encountered: