From 009893f253a46dd260222e383adcb61c32999f99 Mon Sep 17 00:00:00 2001 From: konstin Date: Mon, 9 Oct 2023 14:20:01 +0200 Subject: [PATCH 1/3] Less scary `ruff format` message The ruff formatter has stabilized a good bit since when we added the original message "intended only for experimentation" message. It's time for a less scary message to indicate it is much closer to stable usage than it used to be. I'm not particular about the specific wording, feel free to change the text to something better. ![image](https://github.com/astral-sh/ruff/assets/6826232/225db573-bfda-446f-a403-a577ee270a0b) --- crates/ruff_cli/src/lib.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index 800a16da77546..c5da650a4c6a1 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -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}; @@ -104,8 +105,6 @@ pub fn run( }: Args, ) -> Result { { - use colored::Colorize; - let default_panic_hook = std::panic::take_hook(); std::panic::set_hook(Box::new(move |info| { #[allow(clippy::print_stderr)] @@ -166,9 +165,11 @@ pub fn run( } fn format(args: FormatCommand, log_level: LogLevel) -> Result { - warn_user_once!( - "`ruff format` is a work-in-progress, subject to change at any time, and intended only for \ - experimentation." + eprintln!( + "{}{} The formatter is not stable yet. Code style, configuration and CLI are still subject \ + to change.", + "note".yellow().bold(), + ":".bold() ); let (cli, overrides) = args.partition(); From e5f6ee0637f90e0aa4a67ad518431006499c20ba Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 10 Oct 2023 21:00:38 -0400 Subject: [PATCH 2/3] Tweak message --- crates/ruff_cli/src/lib.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/crates/ruff_cli/src/lib.rs b/crates/ruff_cli/src/lib.rs index c5da650a4c6a1..d51aac5d52b20 100644 --- a/crates/ruff_cli/src/lib.rs +++ b/crates/ruff_cli/src/lib.rs @@ -165,12 +165,7 @@ pub fn run( } fn format(args: FormatCommand, log_level: LogLevel) -> Result { - eprintln!( - "{}{} The formatter is not stable yet. Code style, configuration and CLI are still subject \ - to change.", - "note".yellow().bold(), - ":".bold() - ); + warn_user_once!("`ruff format` is not yet stable, and subject to change in future versions."); let (cli, overrides) = args.partition(); From 9791adb53e1650a8295fa215b0944340315cf8c1 Mon Sep 17 00:00:00 2001 From: konstin Date: Wed, 11 Oct 2023 13:38:54 +0200 Subject: [PATCH 3/3] Update tests --- crates/ruff_cli/tests/format.rs | 6 +++--- crates/ruff_cli/tests/integration_test.rs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ruff_cli/tests/format.rs b/crates/ruff_cli/tests/format.rs index 92ccf123f8201..8f90feb6148be 100644 --- a/crates/ruff_cli/tests/format.rs +++ b/crates/ruff_cli/tests/format.rs @@ -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. "###); } @@ -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(()) } @@ -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(()) } diff --git a/crates/ruff_cli/tests/integration_test.rs b/crates/ruff_cli/tests/integration_test.rs index 7937af211cab3..094b2f5cc4e6e 100644 --- a/crates/ruff_cli/tests/integration_test.rs +++ b/crates/ruff_cli/tests/integration_test.rs @@ -486,7 +486,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. "###); }