Skip to content
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

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

Merged
merged 1 commit into from Oct 23, 2023

Conversation

MichaReiser
Copy link
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
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 formatter Related to the formatter labels Oct 23, 2023
@MichaReiser MichaReiser added this to the Formatter: Beta milestone Oct 23, 2023
@github-actions
Copy link

PR Check Results

Ecosystem

✅ ecosystem check detected no changes.

@MichaReiser MichaReiser merged commit 2f32a57 into main Oct 23, 2023
16 checks passed
@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
Copy link

pipme commented Feb 20, 2024

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
Member Author

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

@pipme
Copy link

pipme commented Feb 20, 2024

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
Member Author

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

@pipme
Copy link

pipme commented Feb 20, 2024

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

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 formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants