input
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from types import TracebackType
if sys.version_info < (3, 11):
from exceptiongroup import ExceptionGroup
ruff --fix
from typing import TYPE_CHECKING
import sys
if TYPE_CHECKING:
pass
if sys.version_info < (3, 11):
pass
problem
The latter is clearly awful code with fully redundant if statements, and the sys and TYPE_CHECKING imports are in fact unused. There seems to be some custom logic for inserting the pass statement, which I think should be removed and this case should not be treated as an auto-fix - since currently you need to manually fix it anyway (except currently you aren't warned about it, and have to check the diff).
Other solutions include warning and/or autofixing* if [...]: pass statements. If they exist, they should be included by default.
This is running a new, clean, venv with no config. Version 0.1.11
- probably only autofix if the condition solely contains checks against
typing.TYPE_CHECKING, sys.platform, sys.version_info and maybe a few more.