Replace --show-source and --no-show-source with --output_format=<full|concise> (#9687)

Fixes #7350

## Summary

* `--show-source` and `--no-show-source` are now deprecated.
* `output-format` supports two new variants, `full` and `concise`.
`text` is now a deprecated variant, and any use of it is treated as the
default serialization format.
* `--output-format` now default to `concise`
* In preview mode, `--output-format` defaults to `full`
* `--show-source` will still set `--output-format` to `full` if the
output format is not otherwise specified.
* likewise, `--no-show-source` can override an output format that was
set in a file-based configuration, though it will also be overridden by
`--output-format`

## Test Plan

A lot of tests were updated to use `--output-format=full`. Additional
tests were added to ensure the correct deprecation warnings appeared,
and that deprecated options behaved as intended.
# Conflicts:
#	crates/ruff/tests/integration_test.rs
This commit is contained in:
Zanie 2024-02-01 08:52:33 -06:00 committed by Zanie Blue
parent ae13d8fddf
commit 6aa643346f
13 changed files with 352 additions and 81 deletions

View file

@ -72,14 +72,14 @@ pub struct Options {
)]
pub extend: Option<String>,
/// The style in which violation messages should be formatted: `"text"`
/// (default), `"grouped"` (group messages by file), `"json"`
/// The style in which violation messages should be formatted: `"full"`
/// (shows source),`"concise"` (default), `"grouped"` (group messages by file), `"json"`
/// (machine-readable), `"junit"` (machine-readable XML), `"github"` (GitHub
/// Actions annotations), `"gitlab"` (GitLab CI code quality report),
/// `"pylint"` (Pylint text format) or `"azure"` (Azure Pipeline logging commands).
#[option(
default = r#""text""#,
value_type = r#""text" | "json" | "junit" | "github" | "gitlab" | "pylint" | "azure""#,
default = r#""concise""#,
value_type = r#""full" | "concise" | "grouped" | "json" | "junit" | "github" | "gitlab" | "pylint" | "azure""#,
example = r#"
# Group violations by containing file.
output-format = "grouped"
@ -117,6 +117,9 @@ pub struct Options {
show-source = true
"#
)]
#[deprecated(
note = "`show_source` is deprecated and is now part of `output_format` in the form of `full` or `concise` options. Please update your configuration."
)]
pub show_source: Option<bool>,
/// Whether to show an enumeration of all fixed lint violations