Skip to content

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

fix(core): `RepeatedWords` should cover adverbs

Elijah Potter2e655a546c82
diff --git a/harper-core/src/linting/repeated_words.rs b/harper-core/src/linting/repeated_words.rs
index 2d8c02178..63adabd92 100644
--- a/harper-core/src/linting/repeated_words.rs
+++ b/harper-core/src/linting/repeated_words.rs
@@ -45,7 +45,8 @@ impl Linter for RepeatedWords {
if (tok_a.kind.is_preposition()
|| tok_a.kind.is_conjunction()
|| !tok_a.kind.is_likely_homograph()
- || self.is_special_case(word_a))
+ || self.is_special_case(word_a)
+ || tok_a.kind.is_adverb())
&& word_a.to_lower() == word_b.to_lower()
{
let intervening_tokens = &chunk[idx_a + 1..*idx_b];
@@ -141,4 +142,13 @@ mod tests {
"Take a look at the project on GitHub.",
);
}
+
+ #[test]
+ fn as_as() {
+ assert_suggestion_result(
+ "he is as as hard as nails",
+ RepeatedWords::default(),
+ "he is as hard as nails",
+ );
+ }
}