Coder Social home page Coder Social logo

Ruff run format command about megalinter HOT 8 OPEN

RomeoAva avatar RomeoAva commented on June 1, 2024
Ruff run format command

from megalinter.

Comments (8)

echoix avatar echoix commented on June 1, 2024 1

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.

from megalinter.

nvuillam avatar nvuillam commented on June 1, 2024 1

So maybe we should declare a second linter "PYTHON_RUFF_FORMATTER" ?

from megalinter.

nvuillam avatar nvuillam commented on June 1, 2024

@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 ?

from megalinter.

RomeoAva avatar RomeoAva commented on June 1, 2024

@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 PYTHON_RUFF_ARGUMENTS: ['format','--check'] I face the following error:

The workflow is not valid. .github/workflows/mega-linter.yml (Line: 27, Col: 26): A sequence was not expected

I believe this is due to the brackets not being allowed here.

And when running it with the following:

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

I get this error:

❌ Linted [PYTHON] files with [ruff]: Found 1 error(s) - (0.02s) (expand for details)
  - Using [ruff v0.1.14] https://megalinter.io/beta/descriptors/python_ruff
  - MegaLinter key: [PYTHON_RUFF]
  - Rules config: [.ruff.toml]
  - Number of files analyzed: [11]
  --Error detail:
  error: unexpected argument '--check' found
  
    tip: to pass '--check' as a value, use '-- --check'
  
  Usage: ruff check <FILES|--fix|--no-fix|--unsafe-fixes|--no-unsafe-fixes|--show-source|--no-show-source|--show-fixes|--no-show-fixes|--diff|--watch|--fix-only|--no-fix-only|--ignore-noqa|--output-format <OUTPUT_FORMAT>|--output-file <OUTPUT_FILE>|--target-version <TARGET_VERSION>|--preview|--no-preview|--config <CONFIG>|--select <RULE_CODE>|--ignore <RULE_CODE>|--extend-select <RULE_CODE>|--extend-ignore <RULE_CODE>|--per-file-ignores <PER_FILE_IGNORES>|--extend-per-file-ignores <EXTEND_PER_FILE_IGNORES>|--exclude <FILE_PATTERN>|--extend-exclude <FILE_PATTERN>|--fixable <RULE_CODE>|--unfixable <RULE_CODE>|--extend-fixable <RULE_CODE>|--extend-unfixable <RULE_CODE>|--respect-gitignore|--no-respect-gitignore|--force-exclude|--no-force-exclude|--line-length <LINE_LENGTH>|--dummy-variable-rgx <DUMMY_VARIABLE_RGX>|--no-cache|--isolated|--cache-dir <CACHE_DIR>|--stdin-filename <STDIN_FILENAME>|--extension <EXTENSION>|--exit-zero|--exit-non-zero-on-fix|--statistics|--add-noqa|--show-files|--show-settings|--ecosystem-ci>

from megalinter.

nvuillam avatar nvuillam commented on June 1, 2024

Would this work ?

PYTHON_RUFF_ARGUMENTS:
- format
- --check

from megalinter.

ipmb avatar ipmb commented on June 1, 2024

That's correct @echoix

Ruff has a linter that is closer to what Flake8 does That is run with ruff check and ruff check --fix

It recently released a formatter that can replace Black. That is run with ruff format --check and ruff format

from megalinter.

github-actions avatar github-actions commented on June 1, 2024

This issue has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this issue should stay open, please remove the O: stale πŸ€– label or comment on the issue.

from megalinter.

echoix avatar echoix commented on June 1, 2024

Bump

from megalinter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.