[ty] Support type:ignore[ty:code] suppressions by MichaReiser · Pull Request #24096 · astral-sh/ruff (original) (raw)

@MichaReiser added the ty

Multi-file analysis & type inference

label

Mar 21, 2026

@MichaReiser

charliermarsh pushed a commit to astral-sh/ty that referenced this pull request

Mar 24, 2026

@MichaReiser

carljm added a commit that referenced this pull request

Mar 25, 2026

@carljm

This was referenced

May 11, 2026

martinpitt pushed a commit to martinpitt/barrage that referenced this pull request

Jun 10, 2026

Since astral-sh/ruff#24096, ty no longer treats mypy-style # type: ignore[code] comments as blanket suppressions: it now matches the bracketed code against its own rule names, so our mypy codes (assignment, attr-defined, type-var, ...) suppress nothing. Add # ty: ignore[code] markers alongside the mypy ones.

Unfortunately ty does not support putting suppression comments on the preceding line, so re-wrap the _ContextEnviron assignment. mypy attributes the error to the value expression while ty attributes it to the assignment target, so the two markers end up on different physical lines.

Signed-off-by: Martin Pitt martin@amutable.com

daandemeyer pushed a commit to amutable-systems/barrage that referenced this pull request

Jun 12, 2026

@daandemeyer

Since astral-sh/ruff#24096, ty no longer treats mypy-style # type: ignore[code] comments as blanket suppressions: it now matches the bracketed code against its own rule names, so our mypy codes (assignment, attr-defined, type-var, ...) suppress nothing. Add # ty: ignore[code] markers alongside the mypy ones.

Unfortunately ty does not support putting suppression comments on the preceding line, so re-wrap the _ContextEnviron assignment. mypy attributes the error to the value expression while ty attributes it to the assignment target, so the two markers end up on different physical lines.

Signed-off-by: Martin Pitt martin@amutable.com

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})