Skip to content

Commit

Permalink
Remove deprecated configuration 'format'
Browse files Browse the repository at this point in the history
  • Loading branch information
tibor-reiss committed Feb 4, 2024
1 parent c53aae0 commit 12d2d69
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
8 changes: 0 additions & 8 deletions crates/ruff/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,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<HelpFormat>,
},
/// List or describe the available configuration options.
Config { option: Option<String> },
Expand All @@ -63,10 +59,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<HelpFormat>,
},
/// Clear any caches in the current directory and any subdirectories.
#[clap(alias = "--clean")]
Expand Down
19 changes: 3 additions & 16 deletions crates/ruff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -114,15 +114,6 @@ fn resolve_default_files(files: Vec<PathBuf>, is_stdin: bool) -> Vec<PathBuf> {
}
}

/// 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>) -> 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,
Expand Down Expand Up @@ -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)?;
}
Expand All @@ -183,10 +172,8 @@ pub fn run(
Ok(ExitStatus::Success)
}
Command::Linter {
format,
mut output_format,
output_format,
} => {
output_format = resolve_help_output_format(output_format, format);
commands::linter::linter(output_format)?;
Ok(ExitStatus::Success)
}
Expand Down

0 comments on commit 12d2d69

Please sign in to comment.