Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--add-noqa removes not selected noqa statements #2254

Closed
spaceone opened this issue Jan 27, 2023 · 1 comment · Fixed by #2465
Closed

--add-noqa removes not selected noqa statements #2254

spaceone opened this issue Jan 27, 2023 · 1 comment · Fixed by #2465
Assignees
Labels
bug Something isn't working

Comments

@spaceone
Copy link
Contributor

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

--add-noqa should not remove any non-selected codes.

@charliermarsh charliermarsh added the bug Something isn't working label Jan 27, 2023
@charliermarsh
Copy link
Member

I think this was an intentional decision but it might be the wrong one.

@charliermarsh charliermarsh self-assigned this Feb 2, 2023
charliermarsh added a commit that referenced this issue Feb 2, 2023
)

The downside here is that we have to leave blank `# noqa` directives intact. Otherwise, we risk removing necessary `# noqa` coverage for rules that aren't selected.

Closes #2254.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants