Skip to content

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

feat: "as if though" + "far and few between" (#1885)

Andrew Dunbar0e28bb71cef8
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rs
index d7119ef24..9b5eabfed 100644
--- a/harper-core/src/linting/phrase_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_corrections/mod.rs
@@ -127,6 +127,13 @@ pub fn lint_group() -> LintGroup {
"Corrects nonstandard `as early back as` to `as far back as`.",
LintKind::WordChoice
),
+ "AsIfThough" => (
+ ["as if though"],
+ ["as if", "as though"],
+ "This should be `as if` or `as though`.",
+ "Corrects redundant `as if though`.",
+ LintKind::Redundancy
+ ),
"AsItHappens" => (
["as it so happens"],
["as it happens"],
@@ -426,6 +433,13 @@ pub fn lint_group() -> LintGroup {
"Corrects malapropisms of `a fair bit`.",
LintKind::Eggcorn
),
+ "FarAndFewBetween" => (
+ ["far and few between"],
+ ["few and far between"],
+ "The correct idiom is `few and far between`?",
+ "Corrects `far and few between` to the standard idiom `few and far between`.",
+ LintKind::Eggcorn
+ ),
"FastPaste" => (
["fast paste", "fast-paste"],
["fast-paced"],
diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rs
index c7e5c44b3..a751ace9d 100644
--- a/harper-core/src/linting/phrase_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_corrections/tests.rs
@@ -135,6 +135,25 @@ fn detect_as_early_back_as_real_world() {
);
}
+// AsIfThough
+#[test]
+fn correct_as_if_though_usagi_1() {
+ assert_top3_suggestion_result(
+ "It's coming back to you. and looking as if though it's very bright red.",
+ lint_group(),
+ "It's coming back to you. and looking as if it's very bright red.",
+ );
+}
+
+#[test]
+fn correct_as_if_though_usagi_2() {
+ assert_top3_suggestion_result(
+ "it passes right on by it as if though nothing happened.",
+ lint_group(),
+ "it passes right on by it as though nothing happened.",
+ );
+}
+
// AsItHappens
#[test]
fn correct_as_it_happens() {
@@ -498,6 +517,16 @@ fn corrects_fair_bit() {
);
}
+// FarAndFewBetween
+#[test]
+fn corrects_far_and_few_between() {
+ assert_suggestion_result(
+ "Their neighbors were far and few between, which only made it even more unlikely that surveillance footage recovered from their properties could help.",
+ lint_group(),
+ "Their neighbors were few and far between, which only made it even more unlikely that surveillance footage recovered from their properties could help.",
+ );
+}
+
// FastPaste
// -none-