Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
fix: fix issue 1495 (#1502)
Andrew Dunbard8fdc7a17b18
diff --git a/harper-core/src/linting/phrasal_verb_as_compound_noun.rs b/harper-core/src/linting/phrasal_verb_as_compound_noun.rsindex 1cedcec1b..c1b6389c5 100644--- a/harper-core/src/linting/phrasal_verb_as_compound_noun.rs+++ b/harper-core/src/linting/phrasal_verb_as_compound_noun.rs@@ -34,7 +34,7 @@ impl Linter for PhrasalVerbAsCompoundNoun {let mut lints = Vec::new();for i in document.iter_noun_indices() {// It would be handy if there could be a dict flag for nouns which are compounds of phrasal verbs.- // Instead let's use a few heuristics.+ // Instead, let's use a few heuristics.let token = document.get_token(i).unwrap();// * Can't also be a proper noun or a real verb.if token.kind.is_proper_noun() || token.kind.is_verb() {@@ -139,7 +139,13 @@ impl Linter for PhrasalVerbAsCompoundNoun {}// "dictionary lookup" is not a mistake but "couples breakup" is.- if prev_tok.kind.is_noun() && !prev_tok.kind.is_plural_noun() {+ // But "settings plugin" is not.+ if prev_tok.kind.is_noun() && !prev_tok.kind.is_plural_noun()+ || prev_tok+ .span+ .get_content(document.get_source())+ .eq_ignore_ascii_case_str("settings")+ {continue;}@@ -410,4 +416,13 @@ mod tests {0,);}++ #[test]+ fn false_positive_issue_1495() {+ assert_lint_count(+ "Color schemes are available by using the Style Settings plugin.",+ PhrasalVerbAsCompoundNoun::default(),+ 0,+ );+ }}