Skip to content

Commit

Permalink
Less scary ruff format message (#7867)
Browse files Browse the repository at this point in the history
  • Loading branch information
konstin authored Oct 11, 2023
1 parent 0f759af commit ec9d5cd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
8 changes: 2 additions & 6 deletions crates/ruff_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::sync::mpsc::channel;

use anyhow::Result;
use clap::CommandFactory;
use colored::Colorize;
use log::warn;
use notify::{recommended_watcher, RecursiveMode, Watcher};

Expand Down Expand Up @@ -104,8 +105,6 @@ pub fn run(
}: Args,
) -> Result<ExitStatus> {
{
use colored::Colorize;

let default_panic_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(move |info| {
#[allow(clippy::print_stderr)]
Expand Down Expand Up @@ -166,10 +165,7 @@ pub fn run(
}

fn format(args: FormatCommand, log_level: LogLevel) -> Result<ExitStatus> {
warn_user_once!(
"`ruff format` is a work-in-progress, subject to change at any time, and intended only for \
experimentation."
);
warn_user_once!("`ruff format` is not yet stable, and subject to change in future versions.");

let (cli, overrides) = args.partition();

Expand Down
6 changes: 3 additions & 3 deletions crates/ruff_cli/tests/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if condition:
print('Hy "Micha"') # Should not change quotes
----- stderr -----
warning: `ruff format` is a work-in-progress, subject to change at any time, and intended only for experimentation.
warning: `ruff format` is not yet stable, and subject to change in future versions.
"###);
}

Expand Down Expand Up @@ -83,7 +83,7 @@ if condition:
print('Should change quotes')
----- stderr -----
warning: `ruff format` is a work-in-progress, subject to change at any time, and intended only for experimentation.
warning: `ruff format` is not yet stable, and subject to change in future versions.
"###);
Ok(())
}
Expand Down Expand Up @@ -139,7 +139,7 @@ if condition:
print('Should change quotes')
----- stderr -----
warning: `ruff format` is a work-in-progress, subject to change at any time, and intended only for experimentation.
warning: `ruff format` is not yet stable, and subject to change in future versions.
"###);
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff_cli/tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ fn stdin_format_jupyter() {
}
----- stderr -----
warning: `ruff format` is a work-in-progress, subject to change at any time, and intended only for experimentation.
warning: `ruff format` is not yet stable, and subject to change in future versions.
"###);
}

Expand Down

0 comments on commit ec9d5cd

Please sign in to comment.