mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 21:25:08 +00:00
![]() ## Summary This PR stabilizes the preview behavior introduced in https://github.com/astral-sh/ruff/pull/15719 to recognize all symbols named `TYPE_CHECKING` as type-checking checks in `if TYPE_CHECKING` conditions. This ensures compatibility with mypy and pyright. This PR also stabilizes the new behavior that removes `if 0:` and `if False` to be no longer considered type checking blocks. Since then, this syntax has been removed from the typing spec and was only used for Python modules that don't have a `typing` module ([comment](https://github.com/astral-sh/ruff/pull/15719#issuecomment-2612787793)). The preview behavior was first released with Ruff 0.9.5 (6th of February), which was about a month ago. There are no open issues or PRs for the changed behavior ## Test Plan The snapshots for `SIM108` change because `SIM108` ignored type checking blocks but it can no simplify `if 0` or `if False` blocks again because they're no longer considered type checking blocks. The changes in the `TC005` snapshot or only due to that `if 0` and `if False` are no longer recognized as type checking blocks <!-- How was it tested? --> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |