Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

fix: don't flag "deus" to change to "imus" (#4671)

Andrew Dunbarb423cd47e906
diff --git a/harper-core/src/linting/wrong_negative.rs b/harper-core/src/linting/wrong_negative.rs
index e38167049..df55ba156 100644
--- a/harper-core/src/linting/wrong_negative.rs
+++ b/harper-core/src/linting/wrong_negative.rs
@@ -12,7 +12,9 @@ fn looks_negative_but_oov(token: &Token, source: &[char]) -> bool {
&& token
.get_ch(source)
.starts_with_any_ignore_ascii_case_str(NEGATIVE_PREFIXES)
- && !token.get_ch(source).eq_ch(&['d', 'e', 'f', 'o'])
+ && !token
+ .get_ch(source)
+ .eq_any_ignore_ascii_case_str(&["defo", "deus"])
}
pub struct WrongNegative<D: Dictionary + 'static> {
@@ -180,4 +182,12 @@ mod tests {
WrongNegative::new(FstDictionary::curated()),
);
}
+
+ #[test]
+ fn dont_flag_deus() {
+ assert_no_lints(
+ "That deus ex machine stuff seems like enormous cope to me",
+ WrongNegative::new(FstDictionary::curated()),
+ );
+ }
}