Skip to content

How to use line-length in command line for ruff format? #8362

@alanwilter

Description

@alanwilter

Plain simple, I want to use ruff format and I don't have any toml configuration.

echo 'aa = [ "blablabla", "blablabla","blablabla","blablabla","blablabla","blablabla","blablabla","blablabla","blablabla","blablabla"]' > test.py
ruff check test.py --select ALL --line-length=120

warning: `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible. Ignoring `one-blank-line-before-class`.
warning: `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible. Ignoring `multi-line-summary-second-line`.
test.py:1:1: D100 Missing docstring in public module
test.py:1:121: E501 Line too long (128 > 120)
Found 2 errors.
(```

But

```bash
ruff format test.py --line-length=120

error: unexpected argument '--line-length' found

  tip: to pass '--line-length' as a value, use '-- --line-length'

Usage: ruff format <FILES|--check|--diff|--config <CONFIG>|--no-cache|--cache-dir <CACHE_DIR>|--respect-gitignore|--no-respect-gitignore|--exclude <FILE_PATTERN>|--force-exclude|--no-force-exclude|--isolated|--stdin-filename <STDIN_FILENAME>|--target-version <TARGET_VERSION>|--preview|--no-preview>

For more information, try '--help'.

If using ruff format test.py it will use the default 88.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions