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

new cli option: --disable-noqa #3070

Closed
onerandomusername opened this issue Feb 20, 2023 · 6 comments · Fixed by #3296
Closed

new cli option: --disable-noqa #3070

onerandomusername opened this issue Feb 20, 2023 · 6 comments · Fixed by #3296
Assignees
Labels
cli Related to the command-line interface

Comments

@onerandomusername
Copy link

There are times when I want to go through the codebase and fix every error that uses a specific error code. It would be helpful to have a cli option to disable all noqa comments for a single command invoke.

For example, if I have a noqa comment for E501, I should be able to view all of my existing E501 errors by running ruff . --disable-noqa --select E501

@charliermarsh charliermarsh added the cli Related to the command-line interface label Feb 20, 2023
@charliermarsh
Copy link
Member

We already support this internally (we use this behavior for --add-noqa), so in theory we could expose it with a flag yeah.

@onerandomusername
Copy link
Author

We already support this internally (we use this behavior for --add-noqa), so in theory we could expose it with a flag yeah.

Thank you! I chose --disable-noqa because its what flake8 uses, but I wouldn't be opposed to --ignore-noqa or any other name.

@charliermarsh
Copy link
Member

Yeah I'd probably prefer --ignore-noqa personally.

@sciyoshi
Copy link
Contributor

Should there be a way to only disable/ignore noqa for certain error codes? For example, a codebase may want to disable using noqa for specific errors altogether. Maybe as a new config in [tool.ruff] for this purpose, e.g. ignore-noqa = [ "E501" ] would prevent # noqa: E501 from working altogether.

@not-my-profile
Copy link
Contributor

Should there be a way to only disable/ignore noqa for certain error codes?

I'd rather have us implement a forbid or force-deny lint level as per #1256 (comment).

Yeah I'd probably prefer --ignore-noqa personally.

I think the CLI option should be called something more generic since we might want to also support # pylint: directives in the future.

@charliermarsh
Copy link
Member

Added in #3296. I left it as --ignore-noqa for now since it's consistent with (e.g.) --add-noqa but I'm open to suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command-line interface
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants