ruff
ruff copied to clipboard
Add "severity" to check and message API
This is part of the LSP diagnostic API so we should implement it.
Out of curiosity, do you plan to mark every violation that results in a error to mark as 'error' according to the LSP API? Especially for flake8, there are a few F...
codes that don't strictly result in an error in your code and should be declared as a Warning, such as e.g. F401
, but then there are also codes like e.g. F523
that would definitely result in an error.
I think we should probably differentiate between errors and warnings, though I need to do some research on how linters typically differentiate between the two. (In ESLint, you can also declare each code to be an error, or a warning, or whatever.) Definitely open to feedback here on what a good system would look like!
I tried finding the severity rules for flake8 in the python extension for vscode (https://github.com/microsoft/vscode-python) but I was unsuccessful. I would say that everything resulting in a error in python should be marked as "error" (obviously), everything else should be considered a warning. I am not sure when Information is useful, and hint maybe wherever a fix is possible?
Maybe you have more luck deciphering the TS code, I never had any issues with the severity flags in vscode so they might be a good inspiration.
Closing in favor of #1256.