Skip to content

Commit

Permalink
Enh: introduce Rule Categories
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Oct 30, 2024
1 parent 60a2dc5 commit 378cce9
Show file tree
Hide file tree
Showing 4 changed files with 1,023 additions and 883 deletions.
8 changes: 8 additions & 0 deletions crates/ruff_dev/src/generate_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::path::PathBuf;
use anyhow::Result;
use itertools::Itertools;
use regex::{Captures, Regex};
use ruff_linter::codes::RuleCategory;
use strum::IntoEnumIterator;

use ruff_diagnostics::FixAvailability;
Expand Down Expand Up @@ -92,6 +93,13 @@ pub(crate) fn main(args: &Args) -> Result<()> {
output.push('\n');
}

let category = rule.category();
if !matches!(category, RuleCategory::Uncategorized) {
output.push_str(&format!(r"Category: {category}."));
output.push('\n');
output.push('\n');
}

process_documentation(
explanation.trim(),
&mut output,
Expand Down
Loading

0 comments on commit 378cce9

Please sign in to comment.