Skip to content

Ruff run format command #3295

@RomeoAva

Description

@RomeoAva

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 command ruff format --check file.py which would give me:

Would reformat: app/file.py
1 file would be reformatted

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:

  PYTHON_RUFF_COMMAND_REMOVE_ARGUMENTS: 'check'
  PYTHON_RUFF_ARGUMENTS: 'format --check'

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

name: Ruff
on: [pull_request]
jobs:
  ruff:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: chartboost/ruff-action@v1
        with:
          src: "./app"
          args: format --check

Any ideas? Thank you for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    O: stale 🤖This issue or pull request is stale, it will be closed if there is no activityquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions