diff options
author | Akshay <[email protected]> | 2021-10-29 13:50:54 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-29 14:14:14 +0100 |
commit | 1a97cce01f8e49b33bf28cbcdfeb3c8aefd809a5 (patch) | |
tree | 62613f193d84ea8b0c0aa94d09758fee19a6042d /bin/src/main.rs | |
parent | d510714ed5a1eae0f6e5e435e4cff4875b06751d (diff) |
report syntax errors as statix errors
- statix now reports errors also, not just warnings
- all diagnostics are available on stderr stream
- non-utf8 files are skipped, does not eject early
Diffstat (limited to 'bin/src/main.rs')
-rw-r--r-- | bin/src/main.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/bin/src/main.rs b/bin/src/main.rs index c5d0626..90b79ce 100644 --- a/bin/src/main.rs +++ b/bin/src/main.rs | |||
@@ -20,17 +20,9 @@ fn _main() -> Result<(), StatixErr> { | |||
20 | match opts.cmd { | 20 | match opts.cmd { |
21 | SubCommand::Check(check_config) => { | 21 | SubCommand::Check(check_config) => { |
22 | let vfs = check_config.vfs()?; | 22 | let vfs = check_config.vfs()?; |
23 | let (lints, errors): (Vec<_>, Vec<_>) = | 23 | let mut stderr = io::stderr(); |
24 | vfs.iter().map(lint::lint).partition(Result::is_ok); | 24 | vfs.iter().map(lint::lint).for_each(|r| { |
25 | let lint_results = lints.into_iter().map(Result::unwrap); | 25 | stderr.write(&r, &vfs, check_config.format).unwrap(); |
26 | let errors = errors.into_iter().map(Result::unwrap_err); | ||
27 | |||
28 | let mut stdout = io::stdout(); | ||
29 | lint_results.for_each(|r| { | ||
30 | stdout.write(&r, &vfs, check_config.format).unwrap(); | ||
31 | }); | ||
32 | errors.for_each(|e| { | ||
33 | eprintln!("{}", e); | ||
34 | }); | 26 | }); |
35 | } | 27 | } |
36 | SubCommand::Fix(fix_config) => { | 28 | SubCommand::Fix(fix_config) => { |