From 99bdafa7b98e478b5375db2d606409aa29150bcd Mon Sep 17 00:00:00 2001 From: Akshay Date: Sat, 5 Feb 2022 11:14:48 +0530 Subject: new subcommand: statix-list produces a list of lints with their error codes, handy for statix-explain or configuring the `disabled` array in .statix.toml --- bin/src/list.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 bin/src/list.rs (limited to 'bin/src/list.rs') diff --git a/bin/src/list.rs b/bin/src/list.rs new file mode 100644 index 0000000..4fe3039 --- /dev/null +++ b/bin/src/list.rs @@ -0,0 +1,14 @@ +pub mod main { + use crate::err::StatixErr; + + use lib::LINTS; + + pub fn main() -> Result<(), StatixErr> { + let mut lints = (&*LINTS).clone(); + lints.as_mut_slice().sort_by(|a, b| a.code().cmp(&b.code())); + for l in lints { + println!("W{:02} {}", l.code(), l.name()); + } + Ok(()) + } +} -- cgit v1.2.3