Skip to content

Commit

Permalink
Remove output-format=text setting (#12836)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser authored Oct 8, 2024
1 parent fc661e1 commit 2fffb4f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 103 deletions.
15 changes: 2 additions & 13 deletions crates/ruff/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -984,17 +984,6 @@ The path `{value}` does not point to a configuration file"
}
}

#[allow(deprecated)]
fn resolve_output_format(
output_format: Option<OutputFormat>,
) -> anyhow::Result<Option<OutputFormat>> {
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)]
Expand Down
10 changes: 2 additions & 8 deletions crates/ruff/src/printer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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()?;
Expand Down Expand Up @@ -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(
Expand Down
36 changes: 0 additions & 36 deletions crates/ruff/tests/deprecation.rs

This file was deleted.

9 changes: 0 additions & 9 deletions crates/ruff_linter/src/settings/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(deprecated)]

use std::fmt::{Display, Formatter};
use std::hash::{Hash, Hasher};
use std::ops::Deref;
Expand Down Expand Up @@ -511,12 +509,6 @@ impl FromIterator<ExtensionPair> 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,
Expand All @@ -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"),
Expand Down
11 changes: 0 additions & 11 deletions crates/ruff_workspace/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <value>` 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
Expand Down
2 changes: 1 addition & 1 deletion docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ Options:
Ignore any `# noqa` comments
--output-format <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 <OUTPUT_FILE>
Expand Down
39 changes: 14 additions & 25 deletions ruff.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2fffb4f

Please sign in to comment.