aboutsummaryrefslogtreecommitdiff
path: root/bin/src/lint.rs
diff options
context:
space:
mode:
authorAkshay <[email protected]>2022-02-19 15:14:59 +0000
committerAkshay <[email protected]>2022-02-19 15:14:59 +0000
commita80e252193096f22ae79fa03e66a0853ddae050e (patch)
tree710796b5feb58173e7c685b432f4654e8ad84e10 /bin/src/lint.rs
parent2aec51a44015e9d466cd4bde3951e4f7e31db0cc (diff)
parallelize statix-check
Diffstat (limited to 'bin/src/lint.rs')
-rw-r--r--bin/src/lint.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/src/lint.rs b/bin/src/lint.rs
index 23a1d10..e1544e1 100644
--- a/bin/src/lint.rs
+++ b/bin/src/lint.rs
@@ -50,6 +50,7 @@ pub mod main {
50 }; 50 };
51 51
52 use lib::session::SessionInfo; 52 use lib::session::SessionInfo;
53 use rayon::prelude::*;
53 54
54 pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> { 55 pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> {
55 let vfs = check_config.vfs()?; 56 let vfs = check_config.vfs()?;
@@ -59,9 +60,13 @@ pub mod main {
59 let version = conf_file.version()?; 60 let version = conf_file.version()?;
60 let session = SessionInfo::from_version(version); 61 let session = SessionInfo::from_version(version);
61 let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session); 62 let lint = |vfs_entry| lint_with(vfs_entry, &lints, &session);
62 let results = vfs.iter().map(lint).collect::<Vec<_>>(); 63 let results = vfs
64 .par_iter()
65 .map(lint)
66 .filter(|lr| !lr.reports.is_empty())
67 .collect::<Vec<_>>();
63 68
64 if results.iter().map(|r| r.reports.len()).sum::<usize>() != 0 { 69 if results.len() != 0 {
65 for r in &results { 70 for r in &results {
66 stdout.write(&r, &vfs, check_config.format).unwrap(); 71 stdout.write(&r, &vfs, check_config.format).unwrap();
67 } 72 }