Skip to content

Commit

Permalink
Some code review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Feb 2, 2024
1 parent 4c25488 commit 0cd0449
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion crates/ruff/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ruff"
version = "0.2.0"
version = "0.2.1"
publish = false
authors = { workspace = true }
edition = { workspace = true }
Expand Down
17 changes: 8 additions & 9 deletions crates/ruff/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,18 +447,17 @@ pub struct FormatCommand {
#[clap(long, overrides_with("preview"), hide = true)]
no_preview: bool,

/// Format code in the given <RANGE>.
/// Formats code in the specified range. When specified, Ruff will try to only format the code in the given range but
/// it might be necessary to extend the start backwards or the end forwards, e.g. to the start or end of the logical line.
///
/// The <RANGE> uses the format `<start_line>:<start_column>-<end_line><end_column>`.
/// The `<RANGE>` uses the format `<start_line>:<start_column>-<end_line><end_column>`.
/// The column numbers are the unicode codepoint from the beginning of the line.
///
/// * The line and column numbers are 1 based.
/// * The end position is exclusive.
/// * The line and column numbers start at 1.
/// * The column numbers are optional, so you can write `--range=1-2` instead of `--range=1:1-2:1`
/// * The end position is optional, so you can write `--range=2` to format the entire document starting from the second line.
/// * The start position is optional, so you can write `--range=-3` to format the first three lines of the document.
///
/// When specified, Ruff will try to only format the code in the given range but
/// it might be necessary to extend the start backwards or the end forwards, e.g. to the start or end of the logical line.
/// * The column numbers are optional. You can write `--range=1-2` instead of `--range=1:1-2:1`
/// * The end position is optional. You can write `--range=2` to format the entire document starting from the second line.
/// * The start position is optional. You can write `--range=-3` to format the first three lines of the document.
///
/// The option can only be used when formatting a single file. Range formatting of notebooks is unsupported.
#[arg(long)]
Expand Down
5 changes: 4 additions & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,10 @@ Options:
Enable preview mode; enables unstable formatting. Use `--no-preview`
to disable
--range <RANGE>
Format code in the given <RANGE>
Formats code in the specified range. When specified, Ruff will try to
only format the code in the given range but it might be necessary to
extend the start backwards or the end forwards, e.g. to the start or
end of the logical line
-h, --help
Print help (see more with '--help')
Expand Down

0 comments on commit 0cd0449

Please sign in to comment.