aboutsummaryrefslogtreecommitdiff
path: root/mingling_cli/src/linter.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-07-21 17:14:58 +0800
committer魏曹先生 <1992414357@qq.com>2026-07-21 17:14:58 +0800
commit91efdea7f7b3a9382cda48a7a6bc2d63a22cf646 (patch)
treeabe723bcd4e135fae87e70fa7736a5299fd2914a /mingling_cli/src/linter.rs
parent4eeda852671468f3823a960a997e154faf41d220 (diff)
feat(linter): add aliases for Rust Analyzer lint commands
Add dispatcher aliases `ra-lint`, `ra-lint-clippy`, and `ra-lint-check` that forward to the existing linter with preset flags for JSON output and optional checkers
Diffstat (limited to 'mingling_cli/src/linter.rs')
-rw-r--r--mingling_cli/src/linter.rs39
1 files changed, 37 insertions, 2 deletions
diff --git a/mingling_cli/src/linter.rs b/mingling_cli/src/linter.rs
index b3b2e7b..ed84efe 100644
--- a/mingling_cli/src/linter.rs
+++ b/mingling_cli/src/linter.rs
@@ -1,6 +1,9 @@
-use mingling::{Program, macros::program_setup};
+use mingling::{
+ Program,
+ macros::{chain, dispatcher, entry, program_setup},
+};
-use crate::linter::cmd_mlint::CMDMinglingLinter;
+use crate::linter::cmd_mlint::{CMDMinglingLinter, EntryMinglingLinter};
pub mod cmd_mlint;
pub mod mlint_attr;
@@ -14,4 +17,36 @@ pub fn mingling_linter_setup(program: &mut Program<crate::ThisProgram>) {
#[program_setup]
pub fn mingling_linter_command_setup(program: &mut Program<crate::ThisProgram>) {
program.with_dispatcher(CMDMinglingLinter);
+ program.with_dispatcher(CMDLinterSupportRustAnalyzer);
+ program.with_dispatcher(CMDLinterSupportRustAnalyzerWithClippy);
+ program.with_dispatcher(CMDLinterSupportRustAnalyzerWithCheck);
+}
+
+// Aliases
+
+dispatcher!("ra-lint-clippy",
+ CMDLinterSupportRustAnalyzerWithClippy => EntryLinterSupportRustAnalyzerWithClippy
+);
+
+dispatcher!("ra-lint-check",
+ CMDLinterSupportRustAnalyzerWithCheck => EntryLinterSupportRustAnalyzerWithCheck
+);
+
+dispatcher!("ra-lint",
+ CMDLinterSupportRustAnalyzer => EntryLinterSupportRustAnalyzer
+);
+
+#[chain]
+pub fn handle_ra_lint(_: EntryLinterSupportRustAnalyzer) -> EntryMinglingLinter {
+ entry!("--message-format=json")
+}
+
+#[chain]
+pub fn handle_ra_lint_check(_: EntryLinterSupportRustAnalyzerWithCheck) -> EntryMinglingLinter {
+ entry!("--message-format=json", "--with-checker=cargo,check")
+}
+
+#[chain]
+pub fn handle_ra_lint_clippy(_: EntryLinterSupportRustAnalyzerWithClippy) -> EntryMinglingLinter {
+ entry!("--message-format=json", "--with-checker=cargo,clippy")
}