Ruff supports file-level noqa comments: # ruff: noqa: TC002 on its own line at the top of a file will lead to the TC002 code being suppressed for the whole file. RUF101, however, appears not to detect these file-level comments when it looks for redirected rule codes; it only flags inline noqa comments of the form # noqa: TCH001.
For example, I would expect Ruff to emit a RUF101 diagnostic on the first line of this snippet, since Ruff's flake8-type-checking rules have been recoded from TCH to TC. However, no RUF101 diagnostic is emitted:
Ruff supports file-level
noqa
comments:# ruff: noqa: TC002
on its own line at the top of a file will lead to theTC002
code being suppressed for the whole file.RUF101
, however, appears not to detect these file-level comments when it looks for redirected rule codes; it only flags inlinenoqa
comments of the form# noqa: TCH001
.For example, I would expect Ruff to emit a
RUF101
diagnostic on the first line of this snippet, since Ruff'sflake8-type-checking
rules have been recoded fromTCH
toTC
. However, noRUF101
diagnostic is emitted:https://play.ruff.rs/26c8939c-fc09-4d85-a25c-f80bea97a842