From 86d0749ed7deaa2af8f0f616b78f73f88743413d Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sat, 11 Feb 2023 17:52:18 -0500 Subject: [PATCH] Use consistent formatting for lint-failure messages (#2782) --- crates/ruff_cli/src/commands.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/ruff_cli/src/commands.rs b/crates/ruff_cli/src/commands.rs index b1b4dde079..812356c34b 100644 --- a/crates/ruff_cli/src/commands.rs +++ b/crates/ruff_cli/src/commands.rs @@ -109,6 +109,12 @@ pub fn run( } .unwrap_or_else(|(path, message)| { if let Some(path) = &path { + error!( + "{}{}{} {message}", + "Failed to lint ".bold(), + fs::relativize_path(path).bold(), + ":".bold() + ); let settings = resolver.resolve(path, pyproject_strategy); if settings.rules.enabled(&Rule::IOError) { Diagnostics::new(vec![Message { @@ -120,11 +126,10 @@ pub fn run( source: None, }]) } else { - error!("Failed to check {}: {message}", path.to_string_lossy()); Diagnostics::default() } } else { - error!("{message}"); + error!("{} {message}", "Encountered error:".bold()); Diagnostics::default() } })