Skip to content

Commit

Permalink
Fix --fix result output to ensure a newline for last message.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Jun 18, 2024
1 parent c126458 commit 60f7953
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions autocorrect-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,22 +233,28 @@ where

log::debug!("Lint result found: {} issues.", lint_results.len());

if !cli.quiet {
log::info!("");
}

if cli.lint {
if cli.formatter.is_diff() {
log::info!("");

let _err_count = *lint_errors_count.lock().unwrap();
let _warn_count = *lint_warnings_count.lock().unwrap();

for lint_result in &lint_results {
log::info!("{}", lint_result.to_diff(cli.no_diff_bg_color))
}

log::info!(
"{}, {}",
format!("Error: {_err_count}").red(),
format!("Warning: {_warn_count}").yellow(),
);
if _err_count > 0 || _warn_count > 0 {
log::info!(
"{}, {}",
format!("Error: {_err_count}").red(),
format!("Warning: {_warn_count}").yellow(),
);
} else {
log::info!("No issues found.");
}

progress::finish(&cli, start_t);

Expand Down

0 comments on commit 60f7953

Please sign in to comment.