Less scary ruff format message (#7867)

This commit is contained in:
konsti 2023-10-11 13:46:41 +02:00 committed by GitHub
parent 0f759af3cf
commit ec9d5cddd6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 10 deletions

View file

@ -6,6 +6,7 @@ use std::sync::mpsc::channel;
use anyhow::Result; use anyhow::Result;
use clap::CommandFactory; use clap::CommandFactory;
use colored::Colorize;
use log::warn; use log::warn;
use notify::{recommended_watcher, RecursiveMode, Watcher}; use notify::{recommended_watcher, RecursiveMode, Watcher};
@ -104,8 +105,6 @@ pub fn run(
}: Args, }: Args,
) -> Result<ExitStatus> { ) -> Result<ExitStatus> {
{ {
use colored::Colorize;
let default_panic_hook = std::panic::take_hook(); let default_panic_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(move |info| { std::panic::set_hook(Box::new(move |info| {
#[allow(clippy::print_stderr)] #[allow(clippy::print_stderr)]
@ -166,10 +165,7 @@ pub fn run(
} }
fn format(args: FormatCommand, log_level: LogLevel) -> Result<ExitStatus> { fn format(args: FormatCommand, log_level: LogLevel) -> Result<ExitStatus> {
warn_user_once!( warn_user_once!("`ruff format` is not yet stable, and subject to change in future versions.");
"`ruff format` is a work-in-progress, subject to change at any time, and intended only for \
experimentation."
);
let (cli, overrides) = args.partition(); let (cli, overrides) = args.partition();

View file

@ -39,7 +39,7 @@ if condition:
print('Hy "Micha"') # Should not change quotes print('Hy "Micha"') # Should not change quotes
----- stderr ----- ----- 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.
"###); "###);
} }
@ -83,7 +83,7 @@ if condition:
print('Should change quotes') print('Should change quotes')
----- stderr ----- ----- 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(()) Ok(())
} }
@ -139,7 +139,7 @@ if condition:
print('Should change quotes') print('Should change quotes')
----- stderr ----- ----- 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(()) Ok(())
} }

View file

@ -485,7 +485,7 @@ fn stdin_format_jupyter() {
} }
----- stderr ----- ----- 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.
"###); "###);
} }