Skip to content

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

fix(core): make nominal phrases an exception for `HowTo` (#2190)

Elijah Potter636770640880
diff --git a/harper-core/src/linting/how_to.rs b/harper-core/src/linting/how_to.rs
index 56b4bfe30..9ecc07d60 100644
--- a/harper-core/src/linting/how_to.rs
+++ b/harper-core/src/linting/how_to.rs
@@ -26,7 +26,7 @@ impl Default for HowTo {
let exceptions = SequenceExpr::default()
.then_unless(UPOSSet::new(&[UPOS::PART]))
.then_anything()
- .then_anything()
+ .then_unless(|tok: &Token, _: &[char]| tok.kind.is_np_member())
.then_anything()
.then_unless(
InflectionOfBe::new().or(SequenceExpr::default().then_kind_any_or_words(
@@ -40,7 +40,7 @@ impl Default for HowTo {
)),
);
- pattern.add(SequenceExpr::default().then(exceptions));
+ pattern.add(exceptions);
Self {
expr: Box::new(pattern),
@@ -296,4 +296,16 @@ mod tests {
HowTo::default(),
);
}
+
+ #[test]
+ fn issue_2124() {
+ assert_no_lints(
+ "I like how discord shows Spotify status on your profile.",
+ HowTo::default(),
+ );
+ assert_no_lints(
+ "To be determined based on how error handling is done in new paradigm.",
+ HowTo::default(),
+ );
+ }
}