mirror of
https://github.com/astral-sh/ruff
synced 2026-01-20 21:10:48 -05:00
Encode prefixes in README headings not just in TOC (#1109)
This commit is contained in:
committed by
GitHub
parent
c5451cd8ad
commit
b8ff209af8
@@ -76,6 +76,7 @@ pub fn main(cli: &Cli) -> Result<()> {
|
||||
.new_enum("CheckCodePrefix")
|
||||
.vis("pub")
|
||||
.derive("EnumString")
|
||||
.derive("AsRefStr")
|
||||
.derive("Debug")
|
||||
.derive("PartialEq")
|
||||
.derive("Eq")
|
||||
@@ -170,9 +171,9 @@ pub fn main(cli: &Cli) -> Result<()> {
|
||||
output.push('\n');
|
||||
output.push_str("use colored::Colorize;");
|
||||
output.push('\n');
|
||||
output.push_str("use serde::{{Serialize, Deserialize}};");
|
||||
output.push_str("use serde::{Deserialize, Serialize};");
|
||||
output.push('\n');
|
||||
output.push_str("use strum_macros::EnumString;");
|
||||
output.push_str("use strum_macros::{AsRefStr, EnumString};");
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
output.push_str("use crate::checks::CheckCode;");
|
||||
|
||||
@@ -7,6 +7,7 @@ use std::path::PathBuf;
|
||||
|
||||
use anyhow::Result;
|
||||
use clap::Args;
|
||||
use itertools::Itertools;
|
||||
use ruff::checks::{CheckCategory, CheckCode};
|
||||
use strum::IntoEnumIterator;
|
||||
|
||||
@@ -24,7 +25,11 @@ pub fn main(cli: &Cli) -> Result<()> {
|
||||
// Generate the table string.
|
||||
let mut output = String::new();
|
||||
for check_category in CheckCategory::iter() {
|
||||
output.push_str(&format!("### {}", check_category.title()));
|
||||
output.push_str(&format!(
|
||||
"### {} ({})",
|
||||
check_category.title(),
|
||||
check_category.codes().iter().map(AsRef::as_ref).join(", ")
|
||||
));
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user