diff --git a/crates/ruff/src/args.rs b/crates/ruff/src/args.rs index 688514ce2cb4b..65f7e0aa0b01c 100644 --- a/crates/ruff/src/args.rs +++ b/crates/ruff/src/args.rs @@ -5,7 +5,7 @@ use std::path::{Path, PathBuf}; use std::str::FromStr; use std::sync::Arc; -use anyhow::{anyhow, bail}; +use anyhow::bail; use clap::builder::{TypedValueParser, ValueParserFactory}; use clap::{command, Parser, Subcommand}; use colored::Colorize; @@ -729,7 +729,7 @@ impl CheckCommand { unsafe_fixes: resolve_bool_arg(self.unsafe_fixes, self.no_unsafe_fixes) .map(UnsafeFixes::from), force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude), - output_format: resolve_output_format(self.output_format)?, + output_format: self.output_format, show_fixes: resolve_bool_arg(self.show_fixes, self.no_show_fixes), extension: self.extension, ..ExplicitConfigOverrides::default() @@ -984,17 +984,6 @@ The path `{value}` does not point to a configuration file" } } -#[allow(deprecated)] -fn resolve_output_format( - output_format: Option, -) -> anyhow::Result> { - if let Some(OutputFormat::Text) = output_format { - Err(anyhow!("`--output-format=text` is no longer supported. Use `--output-format=full` or `--output-format=concise` instead.")) - } else { - Ok(output_format) - } -} - /// CLI settings that are distinct from configuration (commands, lists of files, /// etc.). #[allow(clippy::struct_excessive_bools)] diff --git a/crates/ruff/src/printer.rs b/crates/ruff/src/printer.rs index 4982a8e5097ee..c3181e98a7828 100644 --- a/crates/ruff/src/printer.rs +++ b/crates/ruff/src/printer.rs @@ -244,10 +244,7 @@ impl Printer { #[allow(deprecated)] if matches!( self.format, - OutputFormat::Text - | OutputFormat::Full - | OutputFormat::Concise - | OutputFormat::Grouped + OutputFormat::Full | OutputFormat::Concise | OutputFormat::Grouped ) { if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) { if !diagnostics.fixed.is_empty() { @@ -325,8 +322,6 @@ impl Printer { OutputFormat::Sarif => { SarifEmitter.emit(writer, &diagnostics.messages, &context)?; } - #[allow(deprecated)] - OutputFormat::Text => unreachable!("Text is deprecated and should have been automatically converted to the default serialization format") } writer.flush()?; @@ -368,8 +363,7 @@ impl Printer { } match self.format { - #[allow(deprecated)] - OutputFormat::Text | OutputFormat::Full | OutputFormat::Concise => { + OutputFormat::Full | OutputFormat::Concise => { // Compute the maximum number of digits in the count and code, for all messages, // to enable pretty-printing. let count_width = num_digits( diff --git a/crates/ruff/tests/deprecation.rs b/crates/ruff/tests/deprecation.rs deleted file mode 100644 index 550dbeda1a2d2..0000000000000 --- a/crates/ruff/tests/deprecation.rs +++ /dev/null @@ -1,36 +0,0 @@ -//! A test suite that ensures deprecated command line options have appropriate warnings / behaviors - -use ruff_linter::settings::types::OutputFormat; -use std::process::Command; - -use insta_cmd::{assert_cmd_snapshot, get_cargo_bin}; - -const BIN_NAME: &str = "ruff"; - -const STDIN: &str = "l = 1"; - -fn ruff_check(output_format: OutputFormat) -> Command { - let mut cmd = Command::new(get_cargo_bin(BIN_NAME)); - let output_format = output_format.to_string(); - cmd.arg("check") - .arg("--output-format") - .arg(output_format) - .arg("--no-cache"); - cmd.arg("-"); - - cmd -} - -#[test] -#[allow(deprecated)] -fn ensure_output_format_is_deprecated() { - assert_cmd_snapshot!(ruff_check(OutputFormat::Text).pass_stdin(STDIN), @r###" - success: false - exit_code: 2 - ----- stdout ----- - - ----- stderr ----- - ruff failed - Cause: `--output-format=text` is no longer supported. Use `--output-format=full` or `--output-format=concise` instead. - "###); -} diff --git a/crates/ruff_linter/src/settings/types.rs b/crates/ruff_linter/src/settings/types.rs index eb018883c5d21..e0f38391f5823 100644 --- a/crates/ruff_linter/src/settings/types.rs +++ b/crates/ruff_linter/src/settings/types.rs @@ -1,5 +1,3 @@ -#![allow(deprecated)] - use std::fmt::{Display, Formatter}; use std::hash::{Hash, Hasher}; use std::ops::Deref; @@ -511,12 +509,6 @@ impl FromIterator for ExtensionMapping { #[serde(rename_all = "kebab-case")] #[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))] pub enum OutputFormat { - // Remove the module level `#![allow(deprecated)` when removing the text variant. - // Adding the `#[deprecated]` attribute to text creates clippy warnings about - // using a deprecated item in the derived code and there seems to be no way to suppress the clippy error - // other than disabling the warning for the entire module and/or moving `OutputFormat` to another module. - #[deprecated(note = "Use `concise` or `full` instead")] - Text, Concise, #[default] Full, @@ -535,7 +527,6 @@ pub enum OutputFormat { impl Display for OutputFormat { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { - Self::Text => write!(f, "text"), Self::Concise => write!(f, "concise"), Self::Full => write!(f, "full"), Self::Json => write!(f, "json"), diff --git a/crates/ruff_workspace/src/configuration.rs b/crates/ruff_workspace/src/configuration.rs index c8d4f94f51fc3..b3bd3ee2a373f 100644 --- a/crates/ruff_workspace/src/configuration.rs +++ b/crates/ruff_workspace/src/configuration.rs @@ -454,17 +454,6 @@ impl Configuration { return Err(anyhow!("The `tab-size` option has been renamed to `indent-width` to emphasize that it configures the indentation used by the formatter as well as the tab width. Please update {config_to_update} to use `indent-width = ` instead.")); } - #[allow(deprecated)] - if options.output_format == Some(OutputFormat::Text) { - let config_to_update = path.map_or_else( - || String::from("your `--config` CLI arguments"), - |path| format!("`{}`", fs::relativize_path(path)), - ); - return Err(anyhow!( - r#"The option `output_format=text` is no longer supported. Update {config_to_update} to use `output-format="concise"` or `output-format="full"` instead."# - )); - } - Ok(Self { builtins: options.builtins, cache_dir: options diff --git a/docs/configuration.md b/docs/configuration.md index 94b53c3ae662f..3d8a288a236de 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -589,7 +589,7 @@ Options: Ignore any `# noqa` comments --output-format Output serialization format for violations. The default serialization - format is "full" [env: RUFF_OUTPUT_FORMAT=] [possible values: text, + format is "full" [env: RUFF_OUTPUT_FORMAT=] [possible values: concise, full, json, json-lines, junit, grouped, github, gitlab, pylint, rdjson, azure, sarif] -o, --output-file diff --git a/ruff.schema.json b/ruff.schema.json index 0010ec04f2cac..510c46aa53e63 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -2423,31 +2423,20 @@ "type": "string" }, "OutputFormat": { - "oneOf": [ - { - "type": "string", - "enum": [ - "concise", - "full", - "json", - "json-lines", - "junit", - "grouped", - "github", - "gitlab", - "pylint", - "rdjson", - "azure", - "sarif" - ] - }, - { - "deprecated": true, - "type": "string", - "enum": [ - "text" - ] - } + "type": "string", + "enum": [ + "concise", + "full", + "json", + "json-lines", + "junit", + "grouped", + "github", + "gitlab", + "pylint", + "rdjson", + "azure", + "sarif" ] }, "ParametrizeNameType": {