aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-01-28 13:57:25 +0000
committerGitHub <[email protected]>2022-01-28 13:57:25 +0000
commitea04e018dde7bd8eff069c54899bd3c24af68215 (patch)
tree7da0096a859d9f0e3b7f817d269f2d1c9acebe00
parent7cc887807552b2286c0db5806a9426b3bb50a2be (diff)
parent3d18754b9d744e63a93d61ba2fe931cb105ac5c4 (diff)
Merge pull request #34 from nerdypepper/feat/exit-code
exit with non-zero status if warnings are present
-rw-r--r--bin/src/lint.rs17
1 files changed, 10 insertions, 7 deletions
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 {
54 pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> { 54 pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> {
55 let vfs = check_config.vfs()?; 55 let vfs = check_config.vfs()?;
56 let mut stdout = io::stdout(); 56 let mut stdout = io::stdout();
57
58 let conf_file = ConfFile::discover(&check_config.conf_path)?; 57 let conf_file = ConfFile::discover(&check_config.conf_path)?;
59 let lints = conf_file.lints(); 58 let lints = conf_file.lints();
60 let version = conf_file.version()?; 59 let version = conf_file.version()?;
61
62 let session = SessionInfo::from_version(version); 60 let session = SessionInfo::from_version(version);
63
64 let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session); 61 let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session);
65 vfs.iter().map(lint).for_each(|r| { 62 let results = vfs.iter().map(lint).collect::<Vec<_>>();
66 stdout.write(&r, &vfs, check_config.format).unwrap(); 63
67 }); 64 if results.len() != 0 {
68 Ok(()) 65 for r in &results {
66 stdout.write(&r, &vfs, check_config.format).unwrap();
67 }
68 std::process::exit(1);
69 }
70
71 std::process::exit(0);
69 } 72 }
70} 73}