`redirected-noqa` (`RUF101`) does not detect file-level `# ruff: noqa` comments
Closed this issue · 0 comments
AlexWaygood commented
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: noqa: TCH002
from __future__ import annotations
import local_module
def func(sized: local_module.Container) -> int:
return len(sized)