Add color to fixable error asterisk (#2647)

This commit is contained in:
Charlie Marsh 2023-02-07 19:12:18 -05:00 committed by GitHub
parent 56398e0002
commit 367f115d83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -122,7 +122,8 @@ impl<'a> Printer<'a> {
if num_fixable > 0 {
writeln!(
stdout,
"[*] {num_fixable} potentially fixable with the --fix option."
"[{}] {num_fixable} potentially fixable with the --fix option.",
"*".cyan(),
)?;
}
}
@ -477,7 +478,7 @@ fn num_digits(n: usize) -> usize {
fn print_message<T: Write>(stdout: &mut T, message: &Message) -> Result<()> {
let label = if message.kind.fixable() {
format!(
"{}{}{}{}{}{} {} [*] {}",
"{}{}{}{}{}{} {} [{}] {}",
relativize_path(Path::new(&message.filename)).bold(),
":".cyan(),
message.location.row(),
@ -485,6 +486,7 @@ fn print_message<T: Write>(stdout: &mut T, message: &Message) -> Result<()> {
message.location.column(),
":".cyan(),
message.kind.rule().code().red().bold(),
"*".cyan(),
message.kind.body(),
)
} else {
@ -556,13 +558,14 @@ fn print_grouped_message<T: Write>(
) -> Result<()> {
let label = if message.kind.fixable() {
format!(
" {}{}{}{}{} {} [*] {}",
" {}{}{}{}{} {} [{}] {}",
" ".repeat(row_length - num_digits(message.location.row())),
message.location.row(),
":".cyan(),
message.location.column(),
" ".repeat(column_length - num_digits(message.location.column())),
message.kind.rule().code().red().bold(),
"*".cyan(),
message.kind.body(),
)
} else {