Skip to content

Remove --line-length option from format command - #8131

Merged
MichaReiser merged 1 commit into
mainfrom
remove-line-length-from-format
Oct 23, 2023
Merged

MichaReiser merged 1 commit into
mainfrom
remove-line-length-from-format

Conversation

@MichaReiser

Copy link
Copy Markdown
Member

Summary

This PR removes the undocumented --line-length setting from the format command.
The main reason is that we should either support all formatter options or none of them. I would prefer not supporting formatter options via the CLI.

We can reintroduce the option in the beta based on user feedback.

Test Plan

cargo run --bin ruff -q -- format . --line-length=100
error: unexpected argument '--line-length' found

@MichaReiser

Copy link
Copy Markdown
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@MichaReiser MichaReiser added cli Related to the command-line interface of Ruff or ty formatter Related to the Ruff formatter labels Oct 23, 2023
@MichaReiser MichaReiser added this to the Formatter: Beta milestone Oct 23, 2023
@github-actions

Copy link
Copy Markdown
Contributor

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

@MichaReiser
MichaReiser merged commit 2f32a57 into main Oct 23, 2023
@MichaReiser
MichaReiser deleted the remove-line-length-from-format branch October 23, 2023 23:58
zanieb added a commit that referenced this pull request Oct 30, 2023
zanieb added a commit that referenced this pull request Nov 2, 2023
Restores the `--line-length` option removed in
#8131

Closes #8362
Closes #8352
@pipme

pipme commented Feb 20, 2024

Copy link
Copy Markdown

So what is the way to set a global line length that works across projects in VS Code? astral-sh/ruff-vscode#6

@MichaReiser

Copy link
Copy Markdown
Member Author

You can use --config line-length=100 in the most recent version of ruff

@pipme

pipme commented Feb 20, 2024

Copy link
Copy Markdown

Em, it seems not working. Is the following correct? I am using ruff v0.2.2.

  "ruff.path": ["/opt/homebrew/bin/ruff"],
  "ruff.args": [
    "--config",
    "line-length=100"
  ],

@MichaReiser

Copy link
Copy Markdown
Member Author

The option should either be ruff.lint.args or ruff.format.args. See configuring ruff

@pipme

pipme commented Feb 20, 2024

Copy link
Copy Markdown

Thanks! "ruff.format.args": ["--config", "line-length=79"] works.

KotlinIsland pushed a commit to KotlinIsland/basedpython that referenced this pull request May 1, 2026
Restores the `--line-length` option removed in
astral-sh/ruff#8131

Closes #8362
Closes #8352
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Related to the command-line interface of Ruff or ty formatter Related to the Ruff formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants