Skip to content

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

feat:besides the point→beside the point, don't can→can't (#2021)

Andrew Dunbar12912ba5093e
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rs
index 2f9564e61..1de3d1587 100644
--- a/harper-core/src/linting/phrase_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_corrections/mod.rs
@@ -224,6 +224,13 @@ pub fn lint_group() -> LintGroup {
"Prefer the single-word adverb `beforehand`.",
"`Beforehand` functions as a fixed adverb meaning ‘in advance’; writing it as two words or with a hyphen is nonstandard and can jar readers."
),
+ "BesideThePoint" => (
+ ["besides the point"],
+ ["beside the point"],
+ "Use `beside` in the idiom `beside the point`.",
+ "Corrects `besides the point` to `beside the point`.",
+ LintKind::Eggcorn
+ ),
"BestRegards" => (
["beat regards"],
["best regards"],
@@ -328,6 +335,13 @@ pub fn lint_group() -> LintGroup {
"In English, negation still requires the complete verb form (“want”), so avoid truncating it to “wan.”",
LintKind::Typo
),
+ "DontCan" => (
+ ["don't can"],
+ ["can't", "cannot"],
+ "The grammatically correct form is `can't` or `cannot`.",
+ "Corrects `don't can` to `can't` or `cannot`.",
+ LintKind::Grammar
+ ),
"EachAndEveryOne" => (
["each and everyone"],
["each and every one"],
diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rs
index f0f367c6c..57a706154 100644
--- a/harper-core/src/linting/phrase_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_corrections/tests.rs
@@ -255,6 +255,16 @@ fn allows_beforehand() {
assert_lint_count("We finished the preparations beforehand.", lint_group(), 0);
}
+// BesideThePoint
+#[test]
+fn beside_the_point() {
+ assert_suggestion_result(
+ "we kind of focus on GPUs a lot but uh that's besides the point so uh sometime ago",
+ lint_group(),
+ "we kind of focus on GPUs a lot but uh that's beside the point so uh sometime ago",
+ );
+}
+
// BestRegards
// -none-
@@ -334,6 +344,13 @@ fn does_not_flag_other_contexts() {
// DayAndAge
// -none
+// DegreesKelvin
+#[test]
+fn corrects_degrees_kelvin() {
+ assert_suggestion_result("degrees kelvin", lint_group(), "kelvins");
+ assert_suggestion_result("°K", lint_group(), "K");
+}
+
// DoNotWant
#[test]
fn corrects_dont_wan() {
@@ -354,14 +371,18 @@ fn corrects_mixed_case() {
}
#[test]
-fn corrects_degrees_kelvin() {
- assert_suggestion_result("degrees kelvin", lint_group(), "kelvins");
- assert_suggestion_result("°K", lint_group(), "K");
+fn does_not_flag_already_correct() {
+ assert_lint_count("I don't want to leave.", lint_group(), 0);
}
+// DontCan
#[test]
-fn does_not_flag_already_correct() {
- assert_lint_count("I don't want to leave.", lint_group(), 0);
+fn corrects_dont_can() {
+ assert_suggestion_result(
+ "And currently uh I'm looking at it when I don't can see it like you know where it is, right?",
+ lint_group(),
+ "And currently uh I'm looking at it when I can't see it like you know where it is, right?",
+ );
}
// EachAndEveryOne