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 a rule-specific equivalent of the --ignore-noqa flag #13341

Open
Zac-HD opened this issue Sep 12, 2024 · 2 comments
Open

Add a rule-specific equivalent of the --ignore-noqa flag #13341

Zac-HD opened this issue Sep 12, 2024 · 2 comments
Labels
cli Related to the command-line interface

Comments

@Zac-HD
Copy link

Zac-HD commented Sep 12, 2024

Some linter rules are advisory: they warn about a code pattern which is usually bad, but sometimes it's better for the code (or at least the project) if you slap on a # noqa and keep going.

And some other linter rules are there to warn you against introducing subtle, non-local correctness issues which can lead whole teams to lose their sleep debugging something that should never have happened. (e.g. ASYNC101 warning against PEP-789)


Currently, the only way to ensure that nobody unknowingly suppresses a warning in the latter category is to maintain an entire second configuration, select the subset of rules you want, and then execute a whole independent process to check all your code again. Credit to ruff that it's fast enough to do that, but I still feel it'd be a lot more elegant to accept an ignore-noqa-rules config option and do it in one run!

If this does get implemented, I promise I'll use this new power for good and not evil 😉

@MichaReiser
Copy link
Member

This is interesting. Do I understand it correctly that what you want is that devs can't suppress certain rules?

I'm not sure if an --ignore-noqa flag is the ideal solution for that. I'm thinking of something along the lines of fixable/unfixable (I'm currently thinking about a new configuration structure where this would even be easier), where you could select the rules that can't be suppressed.

@Zac-HD
Copy link
Author

Zac-HD commented Sep 13, 2024

Yeah, unsuppressable would also be a decent name for it.

@MichaReiser MichaReiser added the cli Related to the command-line interface label Sep 13, 2024
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

No branches or pull requests

2 participants