Skip to content

Commit

Permalink
Revert "Remove --line-length option from format command (#8131)"
Browse files Browse the repository at this point in the history
This reverts commit 2f32a57.
  • Loading branch information
zanieb committed Oct 30, 2023
1 parent 161c093 commit 7a4cd39
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions crates/ruff_cli/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,9 @@ pub struct FormatCommand {
force_exclude: bool,
#[clap(long, overrides_with("force_exclude"), hide = true)]
no_force_exclude: bool,
/// Set the line-length.
#[arg(long, help_heading = "Rule configuration", hide = true)]
pub line_length: Option<LineLength>,
/// Ignore all configuration files.
#[arg(long, conflicts_with = "config", help_heading = "Miscellaneous")]
pub isolated: bool,
Expand Down Expand Up @@ -552,6 +555,7 @@ impl FormatCommand {
stdin_filename: self.stdin_filename,
},
CliOverrides {
line_length: self.line_length,
respect_gitignore: resolve_bool_arg(
self.respect_gitignore,
self.no_respect_gitignore,
Expand Down
7 changes: 4 additions & 3 deletions crates/ruff_python_formatter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ quote-style = "single"
```

The Ruff formatter also respects Ruff's [`line-length`](https://docs.astral.sh/ruff/settings/#line-length)
setting, which also can be provided via a `pyproject.toml` or `ruff.toml` file.
setting, which also can be provided via a `pyproject.toml` or `ruff.toml` file, or on the CLI, as
in:

```toml
line-length = 80
```console
ruff format --line-length 100 /path/to/file.py
```

### Excluding code from formatting
Expand Down

0 comments on commit 7a4cd39

Please sign in to comment.