Another problem encountered while working on --add-ignore:
$ cat try.py
import math # noqa: RUF100 with a trailing reason
import sys # noqa: RUF100 # fmt:skip
$ ruff check --add-noqa
Added 2 noqa directives.
$ cat try.py
import math # noqa: F401, RUF100
import sys # noqa: F401, RUF100
I'm surprised this one hasn't been reported before, at least as far as Codex and I found.
ty handles this nicely:
$ cat ty.py
value = missing # ty:ignore[division-by-zero] # fmt: skip
$ uvx ty check --add-ignore ty.py
Added 1 ignore comment
$ cat ty.py
value = missing # ty:ignore[division-by-zero, unresolved-reference] # fmt: skip
$ cat ty.py
value = 1/0 # ty:ignore[division-by-zero] a reason
$ uvx ty check --add-ignore ty.py
Added 1 ignore comment
$ cat ty.py
value = missing # ty:ignore[division-by-zero] a reason # ty:ignore[unresolved-reference]
Another problem encountered while working on
--add-ignore:I'm surprised this one hasn't been reported before, at least as far as Codex and I found.
ty handles this nicely: