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

Is it possible to suppress a rule on a block of code? #9646

Closed
DaniBodor opened this issue Jan 26, 2024 · 1 comment
Closed

Is it possible to suppress a rule on a block of code? #9646

DaniBodor opened this issue Jan 26, 2024 · 1 comment
Labels
suppression Related to supression of violations e.g. noqa

Comments

@DaniBodor
Copy link
Contributor

I would like to disable/suppress ruff (or certain rules of ruff) on a block of code. I know that I can do this for single lines (by using # noqa: <rule_code> at the end of the line) or for entire files/folder (by specifying them in the settings file).

However, I would like to disable ruff on an entire function or on a multi-line block of code, but not an entire file. Is there a way to do this, without adding the noqa to the end of each line?

Thanks

@charliermarsh
Copy link
Member

Unfortunately we don't support block-level suppression right now. I believe this is similar to #3711 so I'm going to merge into that issue.

@charliermarsh charliermarsh closed this as not planned Won't fix, can't repro, duplicate, stale Jan 26, 2024
@charliermarsh charliermarsh added the suppression Related to supression of violations e.g. noqa label Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suppression Related to supression of violations e.g. noqa
Projects
None yet
Development

No branches or pull requests

2 participants