ruff icon indicating copy to clipboard operation
ruff copied to clipboard

--add-noqa adds duplicated noqa comment

Open spaceone opened this issue 2 years ago • 3 comments

$ cat foo.py
from foo import (  # noqa: F401
        bar
)
$ ruff --select F401 --add-noqa foo.py
Added 1 noqa directives.
$ cat foo.py
from foo import (  # noqa: F401
        bar  # noqa: F401
)

spaceone avatar Jan 27 '23 14:01 spaceone

Ah thank you. I probably didn't extend --add-noqa to handle those "parent-style" comments when we added support for them.

charliermarsh avatar Jan 27 '23 14:01 charliermarsh

Does --select RUF100 --fix remove the dupe? (Still a bug.)

charliermarsh avatar Jan 27 '23 14:01 charliermarsh

yes, ruff --select RUF100,F401 --fix foo.py restores the original version

spaceone avatar Jan 27 '23 14:01 spaceone