From 5da1059babbf7fd27e9f5e7ed579c885880c68b6 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Wed, 21 Dec 2022 13:42:02 +0000 Subject: [PATCH] feat(rome_cli): rename `--apply-suggested` to `--apply-unsafe` (#4078) --- crates/rome_cli/src/commands/check.rs | 4 ++-- crates/rome_cli/src/commands/help.rs | 2 +- crates/rome_cli/src/traversal.rs | 2 +- crates/rome_cli/tests/commands/check.rs | 4 ++-- .../tests/snapshots/main_commands_check/apply_noop.snap | 2 +- .../tests/snapshots/main_commands_check/apply_ok.snap | 2 +- .../snapshots/main_commands_check/apply_suggested_error.snap | 2 +- .../main_commands_check/should_disable_a_rule_group.snap | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/rome_cli/src/commands/check.rs b/crates/rome_cli/src/commands/check.rs index ee77fd4703c..6ab786afaf3 100644 --- a/crates/rome_cli/src/commands/check.rs +++ b/crates/rome_cli/src/commands/check.rs @@ -15,12 +15,12 @@ pub(crate) fn check(mut session: CliSession) -> Result<(), CliDiagnostic> { .update_settings(UpdateSettingsParams { configuration })?; let apply = session.args.contains("--apply"); - let apply_suggested = session.args.contains("--apply-suggested"); + let apply_suggested = session.args.contains("--apply-unsafe"); let fix_file_mode = if apply && apply_suggested { return Err(CliDiagnostic::incompatible_arguments( "--apply", - "--apply-suggested", + "--apply-unsafe", )); } else if !apply && !apply_suggested { None diff --git a/crates/rome_cli/src/commands/help.rs b/crates/rome_cli/src/commands/help.rs index 1ac278210ac..3ae3b3f1be8 100644 --- a/crates/rome_cli/src/commands/help.rs +++ b/crates/rome_cli/src/commands/help.rs @@ -35,7 +35,7 @@ const CHECK: Markup = markup! { ""OPTIONS:"" ""--apply"" Apply safe fixes - ""--apply-suggested"" Apply safe and suggested fixes + ""--apply-unsafe"" Apply safe and unsafe fixes ""--max-diagnostics"" Cap the amount of diagnostics displayed (default: 20) ""--verbose"" Print additional verbose advices on diagnostics " diff --git a/crates/rome_cli/src/traversal.rs b/crates/rome_cli/src/traversal.rs index f8675020711..62f455595aa 100644 --- a/crates/rome_cli/src/traversal.rs +++ b/crates/rome_cli/src/traversal.rs @@ -569,7 +569,7 @@ fn process_messages(options: ProcessMessagesOptions) { if mode.is_check() && total_skipped_suggested_fixes > 0 { console.log(markup! { "Skipped "{total_skipped_suggested_fixes}" suggested fixes.\n" - "If you wish to apply the suggested fixes, use the command ""rome check --apply-suggested\n" + "If you wish to apply the suggested (unsafe) fixes, use the command ""rome check --apply-unsafe\n" }) } diff --git a/crates/rome_cli/tests/commands/check.rs b/crates/rome_cli/tests/commands/check.rs index c1ea387368d..952b2927dab 100644 --- a/crates/rome_cli/tests/commands/check.rs +++ b/crates/rome_cli/tests/commands/check.rs @@ -278,7 +278,7 @@ fn apply_suggested_error() { &mut console, Arguments::from_vec(vec![ OsString::from("check"), - OsString::from("--apply-suggested"), + OsString::from("--apply-unsafe"), OsString::from("--apply"), file_path.as_os_str().into(), ]), @@ -308,7 +308,7 @@ fn apply_suggested() { &mut console, Arguments::from_vec(vec![ OsString::from("check"), - OsString::from("--apply-suggested"), + OsString::from("--apply-unsafe"), file_path.as_os_str().into(), ]), ); diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/apply_noop.snap b/crates/rome_cli/tests/snapshots/main_commands_check/apply_noop.snap index a47e9da5cb9..f9ba2ba534a 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/apply_noop.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/apply_noop.snap @@ -14,7 +14,7 @@ if(a != 0) {} ```block Skipped 1 suggested fixes. -If you wish to apply the suggested fixes, use the command rome check --apply-suggested +If you wish to apply the suggested (unsafe) fixes, use the command rome check --apply-unsafe ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/apply_ok.snap b/crates/rome_cli/tests/snapshots/main_commands_check/apply_ok.snap index a47e9da5cb9..f9ba2ba534a 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/apply_ok.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/apply_ok.snap @@ -14,7 +14,7 @@ if(a != 0) {} ```block Skipped 1 suggested fixes. -If you wish to apply the suggested fixes, use the command rome check --apply-suggested +If you wish to apply the suggested (unsafe) fixes, use the command rome check --apply-unsafe ``` diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/apply_suggested_error.snap b/crates/rome_cli/tests/snapshots/main_commands_check/apply_suggested_error.snap index 74a99fdad03..6a92506d065 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/apply_suggested_error.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/apply_suggested_error.snap @@ -16,7 +16,7 @@ console.log(a); ```block flags/invalid ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ - × Incompatible arguments --apply and --apply-suggested + × Incompatible arguments --apply and --apply-unsafe diff --git a/crates/rome_cli/tests/snapshots/main_commands_check/should_disable_a_rule_group.snap b/crates/rome_cli/tests/snapshots/main_commands_check/should_disable_a_rule_group.snap index f40c5188391..474e56e30d2 100644 --- a/crates/rome_cli/tests/snapshots/main_commands_check/should_disable_a_rule_group.snap +++ b/crates/rome_cli/tests/snapshots/main_commands_check/should_disable_a_rule_group.snap @@ -32,7 +32,7 @@ try { ```block Skipped 1 suggested fixes. -If you wish to apply the suggested fixes, use the command rome check --apply-suggested +If you wish to apply the suggested (unsafe) fixes, use the command rome check --apply-unsafe ```