Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix(core): false-positive in `affect -> effect` (#2180)
Elijah Potteraacc73150eed
diff --git a/harper-core/src/linting/noun_verb_confusion/mod.rs b/harper-core/src/linting/noun_verb_confusion/mod.rsindex 199711e0a..a2e3b3eb7 100644--- a/harper-core/src/linting/noun_verb_confusion/mod.rs+++ b/harper-core/src/linting/noun_verb_confusion/mod.rs@@ -1353,4 +1353,12 @@ mod tests {NounVerbConfusion::default(),);}++ #[test]+ fn issue_2008() {+ assert_no_lints(+ "Changes that only affect static types, without breaking runtime behavior.",+ NounVerbConfusion::default(),+ );+ }}diff --git a/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs b/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rsindex cbb1c333b..a25ac8718 100644--- a/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs+++ b/harper-core/src/linting/noun_verb_confusion/verb_instead_of_noun.rs@@ -2,7 +2,7 @@ use crate::{Lrc, Token,expr::{Expr, SequenceExpr},linting::{ExprLinter, Lint, LintKind, Suggestion},- patterns::WordSet,+ patterns::{UPOSSet, WordSet},};use harper_brill::UPOS;@@ -23,7 +23,7 @@ impl Default for VerbInsteadOfNoun {Self {expr: Box::new(SequenceExpr::default()- .then_adjective()+ .then(UPOSSet::new(&[UPOS::ADJ])).then_whitespace().then(verbs.clone()),),@@ -58,7 +58,7 @@ impl ExprLinter for VerbInsteadOfNoun {return None;}- // "Sound" is both adjectve and noun. We want to flag the common "sound advise"+ // "Sound" is both adjective and noun. We want to flag the common "sound advise"// But not "sound affect", which is just as correct as "sound effect".if adj_text == "sound" && verb_text == "affect" {return None;