Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: flag "date back from" as blend of "date from" and "date back to" (#2976)
Charlie Tonneslan581c6a35e799
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rsindex 5d25d4138..9d435a1e7 100644--- a/harper-core/src/linting/phrase_set_corrections/mod.rs+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs@@ -672,6 +672,15 @@ pub fn lint_group() -> LintGroup {"Corrects `copywrite` to `copyright`. `Copywrite` refers to writing copy, while `copyright` is the legal right to creative works.",LintKind::WordChoice),+ "DateBackFrom" => (+ &[+ (&["date back from"], &["date from", "date back to"]),+ (&["dates back from"], &["dates from", "dates back to"]),+ ],+ "Use `date from` or `date back to`, not `date back from`.",+ "Corrects the blend of `date from` and `date back to` into the nonstandard `date back from`.",+ LintKind::Usage+ ),"DoubleEdgedSword" => (&[(&["double edge sword", "double-edge sword", "double edge-sword", "double-edge-sword",diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rsindex 99624b2bd..1ceff09db 100644--- a/harper-core/src/linting/phrase_set_corrections/tests.rs+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs@@ -2160,6 +2160,46 @@ fn copywrote() {);}+// DateBackFrom++#[test]+fn corrects_date_back_from() {+ assert_good_and_bad_suggestions(+ "There are too many open issues that date back from 4 years ago.",+ lint_group(),+ &[+ "There are too many open issues that date from 4 years ago.",+ "There are too many open issues that date back to 4 years ago.",+ ],+ &[],+ );+}++#[test]+fn corrects_dates_back_from() {+ assert_good_and_bad_suggestions(+ "This code dates back from 2014.",+ lint_group(),+ &[+ "This code dates from 2014.",+ "This code dates back to 2014.",+ ],+ &[],+ );+}++#[test]+fn allows_date_back_to() {+ assert_no_lints(+ "These scripts date back to when Perl was popular.",+ lint_group(),+ );+}++// Note: "the date back from" and "get dates back from" are known false+// positives where "date" is a noun (retrieving data). Phrase set matching+// cannot distinguish these from the verb form. See issue #2864.+// DoubleEdgedSword#[test]