Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(harper-cli): return exit code 0 when no lints are found (#2836)
Ryuji Yasukochide214c5085ff
diff --git a/harper-cli/src/lint.rs b/harper-cli/src/lint.rsindex 7be5aa542..d7330cf0e 100644--- a/harper-cli/src/lint.rs+++ b/harper-cli/src/lint.rs@@ -1,8 +1,8 @@use std::borrow::Cow;use std::collections::BTreeMap;+use std::fs;use std::path::{Component, Path, PathBuf};use std::sync::Arc;-use std::{fs, process};use anyhow::Context;use ariadne::{Color, Fmt, Label, Report, ReportKind, Source};@@ -341,6 +341,8 @@ pub fn lint(}}+ let has_lints = !all_lint_kinds.is_empty();+match report_mode {ReportStyle::Json => {println!("{}", serde_json::to_string_pretty(&json_results)?);@@ -359,7 +361,11 @@ pub fn lint(}}- process::exit(1);+ if has_lints {+ anyhow::bail!("Lints were found");+ }++ Ok(())}struct LintOneResult {