mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-02 06:42:02 +00:00
Add colors to statistics output (#2699)
This commit is contained in:
parent
a129181407
commit
417fe4355f
1 changed files with 7 additions and 4 deletions
|
@ -400,18 +400,21 @@ impl<'a> Printer<'a> {
|
|||
.unwrap();
|
||||
let any_fixable = statistics.iter().any(|statistic| statistic.fixable);
|
||||
|
||||
let fixable = format!("[{}] ", "*".cyan());
|
||||
let unfixable = "[ ] ";
|
||||
|
||||
// By default, we mimic Flake8's `--statistics` format.
|
||||
for statistic in statistics {
|
||||
writeln!(
|
||||
stdout,
|
||||
"{:>count_width$}\t{:<code_width$}\t{}{}",
|
||||
statistic.count,
|
||||
statistic.code,
|
||||
statistic.count.to_string().bold(),
|
||||
statistic.code.red().bold(),
|
||||
if any_fixable {
|
||||
if statistic.fixable {
|
||||
"[*] "
|
||||
&fixable
|
||||
} else {
|
||||
"[ ] "
|
||||
unfixable
|
||||
}
|
||||
} else {
|
||||
""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue