From 03e3ba0c3e354c664df30dad3618f18f6d35edde Mon Sep 17 00:00:00 2001 From: Tibor Reiss Date: Sun, 4 Feb 2024 19:45:40 +0100 Subject: [PATCH] Remove deprecated configuration 'format' --- crates/ruff/src/args.rs | 8 -------- crates/ruff/src/lib.rs | 21 +++------------------ 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/crates/ruff/src/args.rs b/crates/ruff/src/args.rs index c5789e2f1a3ff..329c5557dac50 100644 --- a/crates/ruff/src/args.rs +++ b/crates/ruff/src/args.rs @@ -63,10 +63,6 @@ pub enum Command { /// Output format #[arg(long, value_enum, default_value = "text")] output_format: HelpFormat, - - /// Output format (Deprecated: Use `--output-format` instead). - #[arg(long, value_enum, conflicts_with = "output_format", hide = true)] - format: Option, }, /// List or describe the available configuration options. Config { option: Option }, @@ -75,10 +71,6 @@ pub enum Command { /// Output format #[arg(long, value_enum, default_value = "text")] output_format: HelpFormat, - - /// Output format (Deprecated: Use `--output-format` instead). - #[arg(long, value_enum, conflicts_with = "output_format", hide = true)] - format: Option, }, /// Clear any caches in the current directory and any subdirectories. #[clap(alias = "--clean")] diff --git a/crates/ruff/src/lib.rs b/crates/ruff/src/lib.rs index f2414af7b9974..510d0f136978e 100644 --- a/crates/ruff/src/lib.rs +++ b/crates/ruff/src/lib.rs @@ -18,7 +18,7 @@ use ruff_linter::settings::types::SerializationFormat; use ruff_linter::{fs, warn_user, warn_user_once}; use ruff_workspace::Settings; -use crate::args::{Args, CheckCommand, Command, FormatCommand, HelpFormat}; +use crate::args::{Args, CheckCommand, Command, FormatCommand}; use crate::printer::{Flags as PrinterFlags, Printer}; pub mod args; @@ -114,15 +114,6 @@ fn resolve_default_files(files: Vec, is_stdin: bool) -> Vec { } } -/// Get the actual value of the `format` desired from either `output_format` -/// or `format`, and warn the user if they're using the deprecated form. -fn resolve_help_output_format(output_format: HelpFormat, format: Option) -> HelpFormat { - if format.is_some() { - warn_user!("The `--format` argument is deprecated. Use `--output-format` instead."); - } - format.unwrap_or(output_format) -} - pub fn run( Args { command, @@ -166,10 +157,8 @@ pub fn run( Command::Rule { rule, all, - format, - mut output_format, + output_format, } => { - output_format = resolve_help_output_format(output_format, format); if all { commands::rule::rules(output_format)?; } @@ -182,11 +171,7 @@ pub fn run( commands::config::config(option.as_deref())?; Ok(ExitStatus::Success) } - Command::Linter { - format, - mut output_format, - } => { - output_format = resolve_help_output_format(output_format, format); + Command::Linter { output_format } => { commands::linter::linter(output_format)?; Ok(ExitStatus::Success) }