-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Generate Fix
for suppressing violations
#4307
Comments
I had the same thought: astral-sh/ruff-lsp#76 (comment) It does feel much cleaner, however these are not regular fixes (+ it makes every lint "fixable"...) so should be distinguished in some way - how to do it? |
Oh nice, I didn't know about this. Thanks for cross-referencing!
Hmm, that's a good point. I guess we could either:
|
I was thinking, since this is not useful for regular cli usage, but only for LSP-like scenarios, that the LSP should just tell Ruff "please generate these", in one way or another. |
Since it'd be used mostly by LSP, I'd recommend hidden CLI option |
\cc @snowsignal You might be interested in this as it would easier to implement in the native LSP implementation. |
@snowsignal do you think this issue is still relevant after your new LSP implementation? |
@MichaReiser I think this is still relevant because we still need to support noqa suppression comments in the new extension, which calls into Re: #4307 (comment)
With the new Ruff LSP, we should be able to support this, though it will require the implementation of diagnostic caching first. |
This is not fully-fledged, it's more a description of an idea that I would like to explore.
Currently, Ruff serializes the
noqa_row
as part of the JSON messages and the VS code plugin uses that row number to insert thenoqa
comment at the right place. The issue that I have with thenoqa_row
is that it leaks internal details and complicates the LSP because it has to know how to correctly add anoqa
comment.What if ruff would instead generate a second
Fix
to add thenoqa
suppression comment?The text was updated successfully, but these errors were encountered: