From 91efdea7f7b3a9382cda48a7a6bc2d63a22cf646 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 21 Jul 2026 17:14:58 +0800 Subject: 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 --- mingling_cli/src/linter.rs | 39 +++++++++++++++++++++++++++++++++++++-- 1 file 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) { #[program_setup] pub fn mingling_linter_command_setup(program: &mut Program) { 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") } -- cgit