-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Ruff run format command #3295
Comments
@RomeoAva please can you try with: PYTHON_RUFF_COMMAND_REMOVE_ARGUMENTS: 'check'
PYTHON_RUFF_ARGUMENTS: ['format','--check']
LOG_LEVEL: DEBUG And see what is the command line built by MegaLinter in the logs ? |
Hi @nvuillam, when using
I believe this is due to the brackets not being allowed here. And when running it with the following:
I get this error:
|
Would this work ? PYTHON_RUFF_ARGUMENTS:
- format
- --check |
From what I understand, formatting in ruff is more like a second tool, like an (almost) drop in replacement for black, and the linter is a replacement for all other linters. So it's quite possible we'd have to call it like a linter, and a second time just like we call black, for the formatting part. The check flag is like black's check flag, where it will only show if it would change the file, but not do the changes. |
So maybe we should declare a second linter "PYTHON_RUFF_FORMATTER" ? |
That's correct @echoix Ruff has a linter that is closer to what Flake8 does That is run with It recently released a formatter that can replace Black. That is run with |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Bump |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
Hi guys, |
Until this is not made officially available, is there any workaround @RomeoAva that you are using? |
Hi all, I didn't find a work around using this action unfortunately.
|
@nvuillam and maybe even @TommyE123 Do you have an idea on the approach to use for implementing ruff format?
For me, its clear that the linter key will be There is also a list of ruff rules that contradict the ruff formatter, as listed here: https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules. By default, ruff only enables a subset of the now 800+ rules, excluding the ones conflicting with the formatter. Is there anything for us to do here? |
I think that if a linter can format and fix, it should be declared twice:
MegaLinter internal architeture is able to work with the pattern CHECK -> FIX , there is no room for CHECK -> FORMAT -> FIX ^^ And formatters are also non blocking by default |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
@nvuillam I agree. Adding a Is this moving forward? |
Hello,
I am trying to use Ruff through this Github action. My issue is when I use the command
ruff check file.py
it will only alert me on bugs such as imports not used etc, but doesn't alert me on formatting errors. To get those errors I use the commandruff format --check file.py
which would give me:My issue is that the megalinter ruff linter only seems to allow the
check
command. I tried to tweak it inside the mega-linter.yml config but not luck:https://megalinter.io/latest/descriptors/python_ruff/#ruff-documentation
It works with the official Github ruff-action with this workflow but I would prefer to use the one with megalinter since it has more overall features
Any ideas? Thank you for your help
The text was updated successfully, but these errors were encountered: