aboutsummaryrefslogtreecommitdiff
path: root/bin/src/lint.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/src/lint.rs')
-rw-r--r--bin/src/lint.rs21
1 files changed, 17 insertions, 4 deletions
diff --git a/bin/src/lint.rs b/bin/src/lint.rs
index b5856c1..da9ee22 100644
--- a/bin/src/lint.rs
+++ b/bin/src/lint.rs
@@ -13,10 +13,7 @@ pub fn lint(vfs_entry: VfsEntry) -> LintResult {
13 let source = vfs_entry.contents; 13 let source = vfs_entry.contents;
14 let parsed = rnix::parse(source); 14 let parsed = rnix::parse(source);
15 15
16 let error_reports = parsed 16 let error_reports = parsed.errors().into_iter().map(Report::from_parse_err);
17 .errors()
18 .into_iter()
19 .map(Report::from_parse_err);
20 17
21 let reports = parsed 18 let reports = parsed
22 .node() 19 .node()
@@ -36,3 +33,19 @@ pub fn lint(vfs_entry: VfsEntry) -> LintResult {
36 33
37 LintResult { file_id, reports } 34 LintResult { file_id, reports }
38} 35}
36
37pub mod main {
38 use std::io;
39
40 use super::lint;
41 use crate::{config::Check as CheckConfig, err::StatixErr, traits::WriteDiagnostic};
42
43 pub fn main(check_config: CheckConfig) -> Result<(), StatixErr> {
44 let vfs = check_config.vfs()?;
45 let mut stderr = io::stderr();
46 vfs.iter().map(lint).for_each(|r| {
47 stderr.write(&r, &vfs, check_config.format).unwrap();
48 });
49 Ok(())
50 }
51}