Skip to content

Commit

Permalink
feat(cli): Avoid secondary loop
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeee committed Nov 6, 2023
1 parent b9bf5ef commit 4965124
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions crates/biome_cli/src/execute/traverse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,22 +569,20 @@ fn process_messages(options: ProcessMessagesOptions) {
}
}

for diagnostic in &diagnostics_to_print {
console.error(markup! {
{if verbose { PrintDiagnostic::verbose(diagnostic) } else { PrintDiagnostic::simple(diagnostic) }}
});
}

let running_on_github = matches!(
mode.traversal_mode(),
TraversalMode::CI {
environment: Some(ExecutionEnvironment::GitHub),
}
);

if running_on_github {
for diagnostic in diagnostics_to_print {
console.log(markup! {{PrintGitHubDiagnostic::simple(&diagnostic)}});
for diagnostic in &diagnostics_to_print {
console.error(markup! {
{if verbose { PrintDiagnostic::verbose(diagnostic) } else { PrintDiagnostic::simple(diagnostic) }}
});

if running_on_github {
console.log(markup! {{PrintGitHubDiagnostic::simple(diagnostic)}});
}
}

Expand Down

0 comments on commit 4965124

Please sign in to comment.