Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: as oppose to & double edge sword (#2375)
Andrew Dunbarf45aa01d1a2e
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rsindex e8a40e64b..0693cfbb2 100644--- a/harper-core/src/linting/phrase_corrections/mod.rs+++ b/harper-core/src/linting/phrase_corrections/mod.rs@@ -155,6 +155,13 @@ pub fn lint_group() -> LintGroup {"Corrects `as of lately` to `as of late`.",LintKind::WordChoice),+ "AsOpposedTo" => (+ ["as oppose to"],+ ["as opposed to"],+ "Did you mean `as opposed to`?",+ "Corrects `as oppose to` to `as opposed to`.",+ LintKind::Usage+ ),"AtFaceValue" => (["on face value"],["at face value"],diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rsindex a1a1923d9..01f9e8313 100644--- a/harper-core/src/linting/phrase_corrections/tests.rs+++ b/harper-core/src/linting/phrase_corrections/tests.rs@@ -364,6 +364,16 @@ fn corrects_as_of_lately() {)}+// AsOpposedTo+#[test]+fn correct_as_oppose_to() {+ assert_suggestion_result(+ "Distorted image upon opening the app as oppose to running the app after successful build",+ lint_group(),+ "Distorted image upon opening the app as opposed to running the app after successful build",+ );+}+// AtFaceValue#[test]fn correct_on_face_value() {diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rsindex 1db533799..a40b0c5e8 100644--- a/harper-core/src/linting/phrase_set_corrections/mod.rs+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs@@ -394,6 +394,17 @@ 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),+ "DoubleEdgedSword" => (+ &[+ (&["double edge sword", "double-edge sword", "double edge-sword", "double-edge-sword",+ "double edged sword", "double edged-sword", "double-edged-sword"], &["double-edged sword"]),+ (&["double edge swords", "double-edge swords", "double edge-swords", "double-edge-swords",+ "double edged swords", "double edged-swords", "double-edged-swords"], &["double-edged swords"]),+ ],+ "Did you mean `double-edged sword`?",+ "Corrects variants of `double-edged sword`.",+ LintKind::Spelling+ ),"ExpandDecl" => (&[(&["decl"], &["declaration", "declarator"]),diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rsindex 62953c100..02d937f14 100644--- a/harper-core/src/linting/phrase_set_corrections/tests.rs+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs@@ -1073,6 +1073,53 @@ fn copywrote() {);}+// DoubleEdgedSword++#[test]+fn correct_double_edge_hyphen() {+ assert_suggestion_result(+ "I thought the global defaultTranslationValues was potentially a double-edge sword as it also obfuscates the full set of values",+ lint_group(),+ "I thought the global defaultTranslationValues was potentially a double-edged sword as it also obfuscates the full set of values",+ );+}++#[test]+fn correct_double_edge_space() {+ assert_suggestion_result(+ "It becomes a double edge sword when it should not be used in cases like this.",+ lint_group(),+ "It becomes a double-edged sword when it should not be used in cases like this.",+ );+}++#[test]+fn correct_double_edge_space_plural() {+ assert_suggestion_result(+ "Wake locks are really double edge swords.",+ lint_group(),+ "Wake locks are really double-edged swords.",+ );+}++#[test]+fn correct_double_edged_space() {+ assert_suggestion_result(+ "Use case. currently OPTIMIZE is a double edged sword and potentially a very dangerous tool to use.",+ lint_group(),+ "Use case. currently OPTIMIZE is a double-edged sword and potentially a very dangerous tool to use.",+ );+}++#[test]+fn correct_double_edged_space_plural() {+ assert_suggestion_result(+ "Change: Ambushers and Crusaders now protect their targets too, making them double edged swords",+ lint_group(),+ "Change: Ambushers and Crusaders now protect their targets too, making them double-edged swords",+ );+}+// Expat#[test]