Skip to content

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

feat: backhand compliment→backhanded compliment (#4169)

Andrew Dunbarefc2eade097d
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index 9dc0aa50d..15fc8e98e 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -2420,6 +2420,13 @@
"label": "At Lest To Least"
}
},
+ {
+ "Bool": {
+ "name": "BackhandedCompliment",
+ "state": true,
+ "label": "Backhanded Compliment"
+ }
+ },
{
"Bool": {
"name": "BeenThere",
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 4c1aa7018..d1ecb00ae 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -737,6 +737,15 @@ pub fn lint_group() -> LintGroup {
"Suggests using either `await` or `wait for` but not both, as they express the same meaning.",
LintKind::Redundancy
),
+ "BackhandedCompliment" => (
+ &[
+ (&["backhand compliment", "back-hand compliment", "back hand compliment"], &["backhanded compliment"]),
+ (&["backhand compliments", "back-hand compliments", "back hand compliments"], &["backhanded compliments"]),
+ ],
+ "The correct spelling is `backhanded`.",
+ "Corrects `backhand compliment` to `backhanded compliment`.",
+ LintKind::Spelling
+ ),
"CommitmentTo" => (
&[
(&["commitment toward", "commitment towards"], &["commitment to"]),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index 6883625e1..bd683e461 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -2360,6 +2360,72 @@ fn correct_awaited_for() {
);
}
+// BackhandedCompliment
+
+#[test]
+fn correct_backhand_compliment() {
+ assert_suggestion_result(
+ "What's the Most insulting /backhand compliment you have ever received?",
+ test_linter(),
+ "What's the Most insulting /backhanded compliment you have ever received?",
+ );
+}
+
+#[test]
+fn correct_back_hand_compliment_space() {
+ assert_suggestion_result(
+ "Thankfully, I'm a little young to receive that back hand compliment",
+ test_linter(),
+ "Thankfully, I'm a little young to receive that backhanded compliment",
+ );
+}
+
+#[test]
+fn correct_back_hand_compliment_hyphen() {
+ assert_suggestion_result(
+ "They \"have it all\", but still need to back-hand compliment, condescend, \"politely\" hurl passive-aggressive compliments/insults",
+ test_linter(),
+ "They \"have it all\", but still need to backhanded compliment, condescend, \"politely\" hurl passive-aggressive compliments/insults",
+ );
+}
+
+#[test]
+fn correct_backhand_compliments() {
+ assert_suggestion_result(
+ "If backhand compliments or flattery are frequent and come with ulterior motives, it's a red flag.",
+ test_linter(),
+ "If backhanded compliments or flattery are frequent and come with ulterior motives, it's a red flag.",
+ );
+}
+
+#[test]
+fn correct_back_hand_compliments() {
+ assert_suggestion_result(
+ "I am laughing so hard watching the \"commercial\" with her back hand compliments.",
+ test_linter(),
+ "I am laughing so hard watching the \"commercial\" with her backhanded compliments.",
+ );
+}
+
+#[test]
+fn correct_back_hand_compliments_caps() {
+ assert_suggestion_result(
+ "JUST SAY YOU DON'T LIKE THEM STOP GIVING FAKE BACK HAND COMPLIMENTS.",
+ test_linter(),
+ "JUST SAY YOU DON'T LIKE THEM STOP GIVING FAKE BACKHANDED COMPLIMENTS.",
+ );
+}
+
+// no praises, just tons of unnecessary back-hand compliments and lack of support
+#[test]
+fn correct_back_hand_compliments_hyphen() {
+ assert_suggestion_result(
+ "no praises, just tons of unnecessary back-hand compliments and lack of support",
+ test_linter(),
+ "no praises, just tons of unnecessary backhanded compliments and lack of support",
+ );
+}
+
// CommitmentTo
#[test]