Closed
Description
I would like to switch my codebase to ruff format
, but there is one annoying issue that breaks my use case: Some # noqa
comments are moved resulting in issues when calling ruff check
.
Hers's a minimal code snippet to demonstrate what happens:
# test.py (original)
import typing
def foo(
__bar: str,
/,
**specifiers: typing.Any, # noqa: ANN401
) -> int:
return len(specifiers)
$ ruff --version
ruff 0.3.1
$ ruff check --isolated --select ANN401 test.py
$ ruff format --isolated test.py
1 file reformatted
# test.py (reformatted)
import typing
def foo(
__bar: str,
/, # noqa: ANN401
**specifiers: typing.Any,
) -> int:
return len(specifiers)
$ ruff check --isolated --select ANN401 test.py
test.py:7:19: ANN401 Dynamically typed expressions (typing.Any) are disallowed in `**specifiers`
Found 1 error.
I assume this issue is an edge case that has to do with the keyword-only /
syntax being used. Are there any workarounds available?