Skip to content

Commit 406b637

Browse files
committed
progress
1 parent b8e0cb0 commit 406b637

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

crates/pgls_configuration/src/linter/rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl Rules {
7373
pub fn get_severity_from_code(&self, category: &Category) -> Option<Severity> {
7474
let mut split_code = category.name().split('/');
7575
let _category_prefix = split_code.next();
76-
debug_assert_eq!(_category_prefix, Some("linter"));
76+
debug_assert_eq!(_category_prefix, Some("lint"));
7777
let group = <RuleGroup as std::str::FromStr>::from_str(split_code.next()?).ok()?;
7878
let rule_name = split_code.next()?;
7979
let rule_name = Self::has_rule(group, rule_name)?;

xtask/codegen/src/generate_configuration.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ impl ToolConfig {
6060
fn partial_config_struct_name(&self) -> String {
6161
format!("Partial{}", self.config_struct_name())
6262
}
63+
64+
/// Derived: Category prefix used in diagnostics (e.g., "lint" for linter, "splinter" for splinter)
65+
fn category_prefix(&self) -> &'static str {
66+
match self.name {
67+
"linter" => "lint",
68+
"splinter" => "splinter",
69+
"assists" => "assists",
70+
"pglinter" => "pglinter",
71+
_ => self.name,
72+
}
73+
}
6374
}
6475

6576
/// All supported tools
@@ -280,7 +291,7 @@ fn generate_lint_rules_file(
280291
struct_groups.push(generate_lint_group_struct(tool.name, group, &rules));
281292
}
282293

283-
let category_prefix = tool.name;
294+
let category_prefix = tool.category_prefix();
284295
let rules_struct_content = quote! {
285296
//! Generated file, do not edit by hand, see `xtask/codegen`
286297

0 commit comments

Comments
 (0)