Skip to content

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

feat: in retaliation to→in retaliation for/in response to (#3476)

Andrew Dunbar17a3cefb9470
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index 29ac17fc3..a102c26cf 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -3833,6 +3833,13 @@
"label": "A Some Time"
}
},
+ {
+ "Bool": {
+ "name": "InRetaliationTo",
+ "state": true,
+ "label": "In Retaliation To"
+ }
+ },
{
"Bool": {
"name": "CapitalizeOn",
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 241ca6fac..0f872c09e 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -874,6 +874,14 @@ pub fn lint_group() -> LintGroup {
"Corrects `how ... looks like` to `how ... looks` or `what ... looks like`.",
LintKind::Grammar
),
+ "InRetaliationTo" => (
+ &[
+ (&["in retaliation to"], &["in retaliation for", "in response to"]),
+ ],
+ "Did you mean `in retaliation for` or `in response to`?",
+ "Corrects `in retaliation to` to `in retaliation for` or `in response to`.",
+ LintKind::Usage
+ ),
"LevelOfDetails" => (
&[
(&["level of details"], &["level of detail", "levels of detail"]),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index 931a8cb96..88fb60485 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -2896,6 +2896,26 @@ fn correct_how_it_looks_like_with_apostrophe() {
);
}
+// InRetaliationTo
+
+#[test]
+fn corrects_in_retaliation_to_to_for() {
+ assert_suggestion_result(
+ "Damage caused in retaliation to another attack by the Thorns enchantment.",
+ lint_group(),
+ "Damage caused in retaliation for another attack by the Thorns enchantment.",
+ );
+}
+
+#[test]
+fn corrects_in_retaliation_to_to_in_response_to() {
+ assert_suggestion_result(
+ "In retaliation to disagreeing with legal naming issues, a crucial (albeit rather small) section of code was removed from the NPM database",
+ lint_group(),
+ "In response to disagreeing with legal naming issues, a crucial (albeit rather small) section of code was removed from the NPM database",
+ );
+}
+
// LevelOfDetails
#[test]
@@ -2907,7 +2927,6 @@ fn corrects_level_of_details_singular_contrived() {
);
}
-#[test]
fn corrects_levels_of_details_plural_contrived() {
assert_suggestion_result(
"The game uses several level of details to save memory.",