From 3d18754b9d744e63a93d61ba2fe931cb105ac5c4 Mon Sep 17 00:00:00 2001 From: Akshay Date: Sun, 23 Jan 2022 10:25:53 +0530 Subject: exit with non-zero status if warnings are present --- bin/src/lint.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/src/lint.rs b/bin/src/lint.rs index 055bb76..4a8c540 100644 --- a/bin/src/lint.rs +++ b/bin/src/lint.rs @@ -54,17 +54,20 @@ pub mod main { pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> { let vfs = check_config.vfs()?; let mut stdout = io::stdout(); - let conf_file = ConfFile::discover(&check_config.conf_path)?; let lints = conf_file.lints(); let version = conf_file.version()?; - let session = SessionInfo::from_version(version); - let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session); - vfs.iter().map(lint).for_each(|r| { - stdout.write(&r, &vfs, check_config.format).unwrap(); - }); - Ok(()) + let results = vfs.iter().map(lint).collect::>(); + + if results.len() != 0 { + for r in &results { + stdout.write(&r, &vfs, check_config.format).unwrap(); + } + std::process::exit(1); + } + + std::process::exit(0); } } -- cgit v1.2.3