Skip to content

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

fix: exception for "how did you" in how-to linter (#1200)

Andrew Dunbarb5ae7d949c21
diff --git a/harper-core/src/linting/how_to.rs b/harper-core/src/linting/how_to.rs
index ef2e4a2ff..da8f27c29 100644
--- a/harper-core/src/linting/how_to.rs
+++ b/harper-core/src/linting/how_to.rs
@@ -22,10 +22,12 @@ impl Default for HowTo {
.then_anything()
.then_anything()
.then(
- InflectionOfBe::new().or(Box::new(|tok: &Token, _: &[char]| {
+ InflectionOfBe::new().or(Box::new(|tok: &Token, src: &[char]| {
tok.kind.is_auxiliary_verb()
|| tok.kind.is_adjective()
|| tok.kind.is_present_tense_verb()
+ // Special case for "did" as in "how did you do that?"
+ || tok.span.get_content_string(src).eq_ignore_ascii_case("did")
})),
);
@@ -232,4 +234,10 @@ mod tests {
0,
);
}
+
+ #[test]
+ #[ignore]
+ fn dont_flag_how_did_you() {
+ assert_lint_count("How did you get to school every day?", HowTo::default(), 0);
+ }
}