mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 12:29:28 +00:00
Use a separate PrinterFlag
for including fix diffs (#4615)
This commit is contained in:
parent
8961d8eb6f
commit
040fb9cef4
6 changed files with 36 additions and 33 deletions
|
@ -155,13 +155,6 @@ fn format(files: &[PathBuf]) -> Result<ExitStatus> {
|
|||
}
|
||||
|
||||
fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitStatus> {
|
||||
let ecosystem_ci = args.ecosystem_ci;
|
||||
if ecosystem_ci {
|
||||
warn_user_once!(
|
||||
"The formatting of fixes emitted by this option is a work-in-progress, subject to \
|
||||
change at any time, and intended for use with the ecosystem ci scripts only."
|
||||
);
|
||||
}
|
||||
let (cli, overrides) = args.partition();
|
||||
|
||||
// Construct the "default" settings. These are used when no `pyproject.toml`
|
||||
|
@ -219,11 +212,18 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitStatus> {
|
|||
printer_flags |= PrinterFlags::SHOW_VIOLATIONS;
|
||||
}
|
||||
if show_fixes {
|
||||
printer_flags |= PrinterFlags::SHOW_FIXES;
|
||||
printer_flags |= PrinterFlags::SHOW_FIX_SUMMARY;
|
||||
}
|
||||
if show_source {
|
||||
printer_flags |= PrinterFlags::SHOW_SOURCE;
|
||||
}
|
||||
if cli.ecosystem_ci {
|
||||
warn_user_once!(
|
||||
"The formatting of fixes emitted by this option is a work-in-progress, subject to \
|
||||
change at any time, and intended only for internal use."
|
||||
);
|
||||
printer_flags |= PrinterFlags::SHOW_FIX_DIFF;
|
||||
}
|
||||
|
||||
#[cfg(debug_assertions)]
|
||||
if cache {
|
||||
|
@ -248,7 +248,7 @@ fn check(args: CheckArgs, log_level: LogLevel) -> Result<ExitStatus> {
|
|||
return Ok(ExitStatus::Success);
|
||||
}
|
||||
|
||||
let printer = Printer::new(format, log_level, autofix, printer_flags, ecosystem_ci);
|
||||
let printer = Printer::new(format, log_level, autofix, printer_flags);
|
||||
|
||||
if cli.watch {
|
||||
if format != SerializationFormat::Text {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue