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

@ -510,7 +510,9 @@ Options:
Include fixes that may not retain the original intent of the code.
Use `--no-unsafe-fixes` to disable
--show-source
Show violations with source code. Use `--no-show-source` to disable
Show violations with source code. Use `--no-show-source` to disable.
(Deprecated: use `--output-format=full` or `--output-format=concise`
instead of `--show-source` and `--no-show-source`, respectively)
--show-fixes
Show an enumeration of all fixed lint violations. Use
`--no-show-fixes` to disable
@ -526,9 +528,11 @@ Options:
--ignore-noqa
Ignore any `# noqa` comments
--output-format <OUTPUT_FORMAT>
Output serialization format for violations [env: RUFF_OUTPUT_FORMAT=]
[possible values: text, json, json-lines, junit, grouped, github,
gitlab, pylint, azure, sarif]
Output serialization format for violations. The default serialization
format is "concise". In preview mode, the default serialization
format is "full" [env: RUFF_OUTPUT_FORMAT=] [possible values: text,
concise, full, json, json-lines, junit, grouped, github, gitlab,
pylint, azure, sarif]
-o, --output-file <OUTPUT_FILE>
Specify file to write the linter output to (default: stdout)
--target-version <TARGET_VERSION>