aboutsummaryrefslogtreecommitdiff
path: root/bin
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
parent2aec51a44015e9d466cd4bde3951e4f7e31db0cc (diff)
parallelize statix-check
Diffstat (limited to 'bin')
-rw-r--r--bin/Cargo.toml9
-rw-r--r--bin/src/lint.rs9
2 files changed, 12 insertions, 6 deletions
diff --git a/bin/Cargo.toml b/bin/Cargo.toml
index bf39a3a..715e466 100644
--- a/bin/Cargo.toml
+++ b/bin/Cargo.toml
@@ -16,14 +16,15 @@ path = "src/main.rs"
16 16
17[dependencies] 17[dependencies]
18ariadne = "0.1.3" 18ariadne = "0.1.3"
19rnix = "0.10.1"
20clap = "3.0.0-beta.4" 19clap = "3.0.0-beta.4"
21ignore = "0.4.18" 20ignore = "0.4.18"
22thiserror = "1.0.30"
23similar = "2.1.0"
24vfs = { path = "../vfs" }
25lib = { path = "../lib" } 21lib = { path = "../lib" }
22rayon = "1.5.1"
23rnix = "0.10.1"
24similar = "2.1.0"
25thiserror = "1.0.30"
26toml = "0.5.8" 26toml = "0.5.8"
27vfs = { path = "../vfs" }
27 28
28[dependencies.serde] 29[dependencies.serde]
29version = "1.0.68" 30version = "1.0.68"
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 }