MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / print_fix_table

Function print_fix_table

src/fix.rs:481–528  ·  view source on GitHub ↗

Print a file's fixes in a table format.

(path: &str, fixes: &[AppliedFix], use_colour: bool)

Source from the content-addressed store, hash-verified

479
480/// Print a file's fixes in a table format.
481fn print_fix_table(path: &str, fixes: &[AppliedFix], use_colour: bool) {
482 let line_col_w = fixes
483 .iter()
484 .map(|f| f.line.to_string().len())
485 .max()
486 .unwrap_or(0)
487 .max(4);
488
489 let msg_col_w = fixes
490 .iter()
491 .map(|f| f.description.len())
492 .max()
493 .unwrap_or(0)
494 .max(path.len());
495
496 let sep = format!(
497 " {} {}",
498 "-".repeat(line_col_w + 2),
499 "-".repeat(msg_col_w + 2),
500 );
501
502 println!("{sep}");
503 if use_colour {
504 println!(
505 " \x1b[32m{:>line_col_w$}\x1b[0m \x1b[32m{path}\x1b[0m",
506 "Line"
507 );
508 } else {
509 println!(" {:>line_col_w$} {path}", "Line");
510 }
511 println!("{sep}");
512
513 for fix in fixes {
514 let line_str = fix.line.to_string();
515 println!(" {:>line_col_w$} {}", line_str, fix.description);
516 if use_colour {
517 println!(
518 " {:>line_col_w$} \x1b[2m\u{1f527} {}\x1b[0m",
519 "", fix.rule
520 );
521 } else {
522 println!(" {:>line_col_w$} \u{1f527} {}", "", fix.rule);
523 }
524 }
525
526 println!("{sep}");
527 println!();
528}
529
530/// Print the success box (nothing to fix).
531fn print_success_box(use_colour: bool) {

Callers 1

runFunction · 0.85

Calls 2

iterMethod · 0.80
mapMethod · 0.45

Tested by

no test coverage detected