aboutsummaryrefslogtreecommitdiff
path: root/mingling_cli/pre
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-21 16:56:39 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-21 16:56:39 +0800
commitb9d7b8736062509f1f7a5c02943398975ea7ee53 (patch)
tree092c2e69af569522051056008f3b3079f14a0efb /mingling_cli/pre
parent05a06b59d2a27428d253308f067aa0e5a841eb5e (diff)
feat(lint): add non_mingling_naming_style lint with auto-fix suggestions
Support file-level lint checks via `check_file` in lint registry template.
Diffstat (limited to 'mingling_cli/pre')
-rw-r--r--mingling_cli/pre/lint_registry.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/mingling_cli/pre/lint_registry.rs b/mingling_cli/pre/lint_registry.rs
index 09d67f9..e69592b 100644
--- a/mingling_cli/pre/lint_registry.rs
+++ b/mingling_cli/pre/lint_registry.rs
@@ -43,6 +43,22 @@ pub fn gen_mod_file() -> Result<(), Error> {
})
}
+ // Generate file-level lint calls (lints that have `pub fn check_file`)
+ for name in &entries {
+ let file_path = lints_dir.join(format!("{name}.rs"));
+ let has_check_file = fs::read_to_string(&file_path)
+ .map(|c| c.contains("pub fn check_file("))
+ .unwrap_or(false);
+ if has_check_file {
+ tmpl!(template, file_calls {
+ name = name
+ });
+ tmpl!(template, file_lints {
+ name = name
+ });
+ }
+ }
+
fs::write(&mod_file, template.to_string())?;
Ok(())