-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule
Description
I had some code that was similar to:
import sys
def is_python3():
if sys.version_info >= (3, 0):
return True
return False
(This matches the style required by RET505.)
If I then run:
% ruff check --select F401,UP036 foo.py --target-version py39 --unsafe-fixes --fix
Found 2 errors (2 fixed, 0 remaining).
I get an output of:
def is_python3():
return True
return False
It would both:
- Be good if UP036's (admittedly unsafe) fix didn't leave obviously dead code behind,
- Be good to have some rule that catches at least trivial dead code like this (which doesn't need any sort of CFG analysis to find).
Mostly filing this as a feature request for the latter, because I'm… in that state now.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ruleImplementing or modifying a lint ruleImplementing or modifying a lint rule