-
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
Respect pylint ignore directives #1203
Comments
+1 for this feature |
I think there are two pieces here:
I'm open to supporting (1), but it does require a decent amount of work, since Pylint provides a lot of flexibility in where enables and disables are placed (scopes, blocks, single lines, etc.). (Unrelated to this issue, but I do eventually want to add Ruff's own system for ignores that's decoupled from Flake8 (while continuing to support Flake8's I'm hesitant to support (2). It feels hard to get right, since it requires that (e.g.) we're reporting errors on the exact same lines. |
I guess (1) is already good enough. For (2) there is some easy wins. For example at rotki we disable the ruff "BLE" check due to also running pylint with that check on and ruff not respecting/seeing the ignores. |
In the case of replacing pylint entirely with ruff, there could simply be a rule RUFF9XX that detects pylint directives, and as autofix removes them. This could be simple to implement and helpful to start. When explicit mapping is available, the fix could be changed to use flake8 or ruff directives. |
A fixer which transforms the pylint-comments into ruff noqa-comments would be helpful. -# pylint: disable-msg=R0133
+# noqa: PLR0133 |
+1 |
This comment has been minimized.
This comment has been minimized.
Pylint disable support rule names. Without rule names, this lowers the value of the waiver comment.
After this transformation the next person arriving at the code will not easily understand why the disable is there. After ruff adopts #1773 "human-friendly rules names", this transformation feels more attractive. |
A possible way forward could be to only some kind of directive to start. Or is there a risk that would cause more confusion? |
It would be really cool for a codebase moving from pylint slowly to ruff to be able to understand and respect pylint directives.
For example
ARG
module has flake8-unused-arguments. That is very similar to something pylint does. And as usual if somewhere you want to disable the warning you can add the proper pylint directive. For this it would be# pylint: disable=unused-argument
.It would be cool if ruff understood those directives even for other modules like flake8-unused-arguments which do the same thing.
The text was updated successfully, but these errors were encountered: