mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +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 {
|
if num_fixable > 0 {
|
||||||
writeln!(
|
writeln!(
|
||||||
stdout,
|
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<()> {
|
fn print_message<T: Write>(stdout: &mut T, message: &Message) -> Result<()> {
|
||||||
let label = if message.kind.fixable() {
|
let label = if message.kind.fixable() {
|
||||||
format!(
|
format!(
|
||||||
"{}{}{}{}{}{} {} [*] {}",
|
"{}{}{}{}{}{} {} [{}] {}",
|
||||||
relativize_path(Path::new(&message.filename)).bold(),
|
relativize_path(Path::new(&message.filename)).bold(),
|
||||||
":".cyan(),
|
":".cyan(),
|
||||||
message.location.row(),
|
message.location.row(),
|
||||||
|
@ -485,6 +486,7 @@ fn print_message<T: Write>(stdout: &mut T, message: &Message) -> Result<()> {
|
||||||
message.location.column(),
|
message.location.column(),
|
||||||
":".cyan(),
|
":".cyan(),
|
||||||
message.kind.rule().code().red().bold(),
|
message.kind.rule().code().red().bold(),
|
||||||
|
"*".cyan(),
|
||||||
message.kind.body(),
|
message.kind.body(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
@ -556,13 +558,14 @@ fn print_grouped_message<T: Write>(
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let label = if message.kind.fixable() {
|
let label = if message.kind.fixable() {
|
||||||
format!(
|
format!(
|
||||||
" {}{}{}{}{} {} [*] {}",
|
" {}{}{}{}{} {} [{}] {}",
|
||||||
" ".repeat(row_length - num_digits(message.location.row())),
|
" ".repeat(row_length - num_digits(message.location.row())),
|
||||||
message.location.row(),
|
message.location.row(),
|
||||||
":".cyan(),
|
":".cyan(),
|
||||||
message.location.column(),
|
message.location.column(),
|
||||||
" ".repeat(column_length - num_digits(message.location.column())),
|
" ".repeat(column_length - num_digits(message.location.column())),
|
||||||
message.kind.rule().code().red().bold(),
|
message.kind.rule().code().red().bold(),
|
||||||
|
"*".cyan(),
|
||||||
message.kind.body(),
|
message.kind.body(),
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue