mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-27 04:19:18 +00:00
Add rendering of rule markdown for terminal output (#2747)
Add rendering of rule markdown for terminal output This is achieved by making use of the `mdcat` crate. See the following links for details: - https://crates.io/crates/mdcat - https://github.com/swsnr/mdcat - https://docs.rs/mdcat/latest/mdcat/
This commit is contained in:
parent
1b61d4e18b
commit
551b810aeb
9 changed files with 922 additions and 49 deletions
|
@ -47,6 +47,30 @@ pub fn linter(format: HelpFormat) {
|
|||
println!("{}", serde_json::to_string_pretty(&linters).unwrap());
|
||||
}
|
||||
}
|
||||
|
||||
HelpFormat::Markdown => {
|
||||
#[allow(clippy::print_stdout)]
|
||||
{
|
||||
println!("| {:>6} | {:<27} |", "Prefix", "Name");
|
||||
println!("| {:>6} | {:<27} |", "------", "-".repeat(27));
|
||||
}
|
||||
for linter in Linter::iter() {
|
||||
let prefix = match linter.common_prefix() {
|
||||
"" => linter
|
||||
.upstream_categories()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|UpstreamCategory(prefix, ..)| prefix.as_ref())
|
||||
.join("/"),
|
||||
prefix => prefix.to_string(),
|
||||
};
|
||||
|
||||
#[allow(clippy::print_stdout)]
|
||||
{
|
||||
println!("| {:>6} | {:<27} |", prefix, linter.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue