mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 14:52:01 +00:00
Add color to fixable error asterisk (#2647)
This commit is contained in:
parent
56398e0002
commit
367f115d83
1 changed files with 6 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue