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

@ -31,8 +31,6 @@ pub struct Settings {
pub output_format: SerializationFormat,
#[cache_key(ignore)]
pub show_fixes: bool,
#[cache_key(ignore)]
pub show_source: bool,
pub file_resolver: FileResolverSettings,
pub linter: LinterSettings,
@ -46,9 +44,8 @@ impl Default for Settings {
cache_dir: cache_dir(project_root),
fix: false,
fix_only: false,
output_format: SerializationFormat::default(),
output_format: SerializationFormat::default(false),
show_fixes: false,
show_source: false,
unsafe_fixes: UnsafeFixes::default(),
linter: LinterSettings::new(project_root),
file_resolver: FileResolverSettings::new(project_root),
@ -70,7 +67,6 @@ impl fmt::Display for Settings {
self.fix_only,
self.output_format,
self.show_fixes,
self.show_source,
self.unsafe_fixes,
self.file_resolver | nested,
self.linter | nested,