-
-
Notifications
You must be signed in to change notification settings - Fork 244
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
feat: add ruff linter #2458
feat: add ruff linter #2458
Conversation
Ruff markets itself as a much faster replacement for flake8, isort, and possibly other linters we already include in the Python flavor. It feels like it defeats the purpose of adding Ruff to leave the linters it duplicates in, but on the other hand maybe we should wait to remove the other linters until MegaLinter v7. What do folks think? |
I think ruff and the others can be both in MegaLinter for now, and users will decide which one they use :) |
Ruff can be configured either in Would Edit: It seems like |
I think that in the middle-term future, we should find a way to properly handle what's defined in pyproject.toml, since it's where Python projects should go, and it's supposed to be there where the tools used are defined. But that means parsing that file, not only detecting its presence. That pyproject.toml handling doesn't need to be ready for the first inclusion of ruff. @nvuillam @Kurt-von-Laven what are your opinions on this? |
That could be an option on desceptors to avoid using the default config file while there is something in the pyproject, indeed :) |
Maybe
The options could then be checked in order and the first matching file could be used. For - config_file_name:
- file: "pyproject.toml"
check: matches_regex
regex: "\\[tool\\.ruff"
- file: "ruff.toml"
check: file_exists
- file: ".ruff.toml"
check: file_exists Property names, |
I think we discussed that in another PR, that's definitely something to do :) Meanwhile, config file name can be forced in local repo config |
@lars-reimann the fixes number is computed from the list of files that are detected as updated after the linting :) |
Alright, this is done from my side then. |
The PR looks great :) |
Personally, I feel that we should make |
Looks like Trivy was also happy this time round. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great :)
Many many thanks for this contribution :)
Note that Ruff only enables a tiny subset of available rules by default, so if one wishes to replace Bandit, Flake8, and isort for best performance, they would need to configure Ruff explicitly. |
Fixes #2153
Proposed Changes
ruff
Python linter.Readiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance