Skip to content

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

fix: solve that/than false positive (#1664)

Andrew Dunbarbdc6b1b16ba4
diff --git a/harper-core/src/linting/that_than.rs b/harper-core/src/linting/that_than.rs
index abb7d2077..7d2732621 100644
--- a/harper-core/src/linting/that_than.rs
+++ b/harper-core/src/linting/that_than.rs
@@ -16,7 +16,9 @@ impl Default for ThatThan {
return false;
}
let adj = tok.span.get_content(src);
- !adj.eq_ignore_ascii_case_str("better") && !adj.eq_ignore_ascii_case_str("later")
+ !&["better", "later", "number"]
+ .iter()
+ .any(|&s| adj.eq_ignore_ascii_case_str(s))
})
.t_ws()
.t_aco("that")
@@ -230,4 +232,13 @@ mod tests {
0,
)
}
+
+ #[test]
+ fn dont_flag_number_that_1663() {
+ assert_lint_count(
+ " 455 │ `MAJOR.MINOR.PATCH` version number that increments with:",
+ ThatThan::default(),
+ 0,
+ )
+ }
}