Lints and suggestions for the Nix programming language
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #34 from nerdypepper/feat/exit-code

exit with non-zero status if warnings are present

authored by

Akshay and committed by
GitHub
ea04e018 7cc88780

+10 -7
+10 -7
bin/src/lint.rs
··· 54 54 pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> { 55 55 let vfs = check_config.vfs()?; 56 56 let mut stdout = io::stdout(); 57 - 58 57 let conf_file = ConfFile::discover(&check_config.conf_path)?; 59 58 let lints = conf_file.lints(); 60 59 let version = conf_file.version()?; 60 + let session = SessionInfo::from_version(version); 61 + let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session); 62 + let results = vfs.iter().map(lint).collect::<Vec<_>>(); 61 63 62 - let session = SessionInfo::from_version(version); 64 + if results.len() != 0 { 65 + for r in &results { 66 + stdout.write(&r, &vfs, check_config.format).unwrap(); 67 + } 68 + std::process::exit(1); 69 + } 63 70 64 - let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session); 65 - vfs.iter().map(lint).for_each(|r| { 66 - stdout.write(&r, &vfs, check_config.format).unwrap(); 67 - }); 68 - Ok(()) 71 + std::process::exit(0); 69 72 } 70 73 }