Skip to content

Commit 202c6a6

Browse files
MichaReiserAlexWaygood
authored andcommitted
Remove output-format=text setting (#12836)
1 parent 5c3c0c4 commit 202c6a6

File tree

7 files changed

+19
-103
lines changed

7 files changed

+19
-103
lines changed

crates/ruff/src/args.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
55
use std::str::FromStr;
66
use std::sync::Arc;
77

8-
use anyhow::{anyhow, bail};
8+
use anyhow::bail;
99
use clap::builder::{TypedValueParser, ValueParserFactory};
1010
use clap::{command, Parser, Subcommand};
1111
use colored::Colorize;
@@ -729,7 +729,7 @@ impl CheckCommand {
729729
unsafe_fixes: resolve_bool_arg(self.unsafe_fixes, self.no_unsafe_fixes)
730730
.map(UnsafeFixes::from),
731731
force_exclude: resolve_bool_arg(self.force_exclude, self.no_force_exclude),
732-
output_format: resolve_output_format(self.output_format)?,
732+
output_format: self.output_format,
733733
show_fixes: resolve_bool_arg(self.show_fixes, self.no_show_fixes),
734734
extension: self.extension,
735735
..ExplicitConfigOverrides::default()
@@ -984,17 +984,6 @@ The path `{value}` does not point to a configuration file"
984984
}
985985
}
986986

987-
#[allow(deprecated)]
988-
fn resolve_output_format(
989-
output_format: Option<OutputFormat>,
990-
) -> anyhow::Result<Option<OutputFormat>> {
991-
if let Some(OutputFormat::Text) = output_format {
992-
Err(anyhow!("`--output-format=text` is no longer supported. Use `--output-format=full` or `--output-format=concise` instead."))
993-
} else {
994-
Ok(output_format)
995-
}
996-
}
997-
998987
/// CLI settings that are distinct from configuration (commands, lists of files,
999988
/// etc.).
1000989
#[allow(clippy::struct_excessive_bools)]

crates/ruff/src/printer.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,7 @@ impl Printer {
244244
#[allow(deprecated)]
245245
if matches!(
246246
self.format,
247-
OutputFormat::Text
248-
| OutputFormat::Full
249-
| OutputFormat::Concise
250-
| OutputFormat::Grouped
247+
OutputFormat::Full | OutputFormat::Concise | OutputFormat::Grouped
251248
) {
252249
if self.flags.intersects(Flags::SHOW_FIX_SUMMARY) {
253250
if !diagnostics.fixed.is_empty() {
@@ -325,8 +322,6 @@ impl Printer {
325322
OutputFormat::Sarif => {
326323
SarifEmitter.emit(writer, &diagnostics.messages, &context)?;
327324
}
328-
#[allow(deprecated)]
329-
OutputFormat::Text => unreachable!("Text is deprecated and should have been automatically converted to the default serialization format")
330325
}
331326

332327
writer.flush()?;
@@ -368,8 +363,7 @@ impl Printer {
368363
}
369364

370365
match self.format {
371-
#[allow(deprecated)]
372-
OutputFormat::Text | OutputFormat::Full | OutputFormat::Concise => {
366+
OutputFormat::Full | OutputFormat::Concise => {
373367
// Compute the maximum number of digits in the count and code, for all messages,
374368
// to enable pretty-printing.
375369
let count_width = num_digits(

crates/ruff/tests/deprecation.rs

Lines changed: 0 additions & 36 deletions
This file was deleted.

crates/ruff_linter/src/settings/types.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![allow(deprecated)]
2-
31
use std::fmt::{Display, Formatter};
42
use std::hash::{Hash, Hasher};
53
use std::ops::Deref;
@@ -511,12 +509,6 @@ impl FromIterator<ExtensionPair> for ExtensionMapping {
511509
#[serde(rename_all = "kebab-case")]
512510
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
513511
pub enum OutputFormat {
514-
// Remove the module level `#![allow(deprecated)` when removing the text variant.
515-
// Adding the `#[deprecated]` attribute to text creates clippy warnings about
516-
// using a deprecated item in the derived code and there seems to be no way to suppress the clippy error
517-
// other than disabling the warning for the entire module and/or moving `OutputFormat` to another module.
518-
#[deprecated(note = "Use `concise` or `full` instead")]
519-
Text,
520512
Concise,
521513
#[default]
522514
Full,
@@ -535,7 +527,6 @@ pub enum OutputFormat {
535527
impl Display for OutputFormat {
536528
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
537529
match self {
538-
Self::Text => write!(f, "text"),
539530
Self::Concise => write!(f, "concise"),
540531
Self::Full => write!(f, "full"),
541532
Self::Json => write!(f, "json"),

crates/ruff_workspace/src/configuration.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -454,17 +454,6 @@ impl Configuration {
454454
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."));
455455
}
456456

457-
#[allow(deprecated)]
458-
if options.output_format == Some(OutputFormat::Text) {
459-
let config_to_update = path.map_or_else(
460-
|| String::from("your `--config` CLI arguments"),
461-
|path| format!("`{}`", fs::relativize_path(path)),
462-
);
463-
return Err(anyhow!(
464-
r#"The option `output_format=text` is no longer supported. Update {config_to_update} to use `output-format="concise"` or `output-format="full"` instead."#
465-
));
466-
}
467-
468457
Ok(Self {
469458
builtins: options.builtins,
470459
cache_dir: options

docs/configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ Options:
589589
Ignore any `# noqa` comments
590590
--output-format <OUTPUT_FORMAT>
591591
Output serialization format for violations. The default serialization
592-
format is "full" [env: RUFF_OUTPUT_FORMAT=] [possible values: text,
592+
format is "full" [env: RUFF_OUTPUT_FORMAT=] [possible values:
593593
concise, full, json, json-lines, junit, grouped, github, gitlab,
594594
pylint, rdjson, azure, sarif]
595595
-o, --output-file <OUTPUT_FILE>

ruff.schema.json

Lines changed: 14 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)