Skip to content

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

feat: set up a bad example→set a bad example (#4488)

Andrew Dunbar21f5efe53b3f
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index cc4507a17..3b189d9e6 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -5690,6 +5690,13 @@
"label": "Scantily Clad"
}
},
+ {
+ "Bool": {
+ "name": "SetABadExample",
+ "state": true,
+ "label": "Set a Bad Example"
+ }
+ },
{
"Bool": {
"name": "SimilarLike",
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 95fac100b..429fa6111 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -679,6 +679,16 @@ pub fn lint_group() -> LintGroup {
"Corrects `seam` to `seem` when used as a verb meaning `to appear` or `to give the impression`.",
LintKind::Spelling
),
+ "SetABadExample" => (
+ &[
+ ("set up a bad example", "set a bad example"),
+ ("sets up a bad example", "sets a bad example"),
+ ("setting up a bad example", "setting a bad example"),
+ ],
+ "Are you confusing `set up` and `set a bad example`? The latter does not use the word `up`.",
+ "Corrects `set up a bad example` to `set a bad example`.",
+ LintKind::Usage
+ ),
"SubjunctiveWasToWere" => (
&[
("if only there was", "if only there were"),
diff --git a/harper-core/src/linting/phrase_set_corrections/one_to_one_tests.rs b/harper-core/src/linting/phrase_set_corrections/one_to_one_tests.rs
index 5fe369dff..68a34547a 100644
--- a/harper-core/src/linting/phrase_set_corrections/one_to_one_tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/one_to_one_tests.rs
@@ -2183,6 +2183,35 @@ fn fix_everyone_seams_combined_with_now_a_days() {
);
}
+// SetABadExample
+
+#[test]
+fn fix_setting_up_a_bad_example() {
+ assert_suggestion_result(
+ "Are our neighbours setting up a bad example ?",
+ test_linter(),
+ "Are our neighbours setting a bad example ?",
+ )
+}
+
+#[test]
+fn fix_set_up_a_bad_example() {
+ assert_suggestion_result(
+ "It works sometimes but set up a bad example.",
+ test_linter(),
+ "It works sometimes but set a bad example.",
+ )
+}
+
+#[test]
+fn fix_sets_up_a_bad_example() {
+ assert_suggestion_result(
+ "This sets up a bad example that will make it into a trend. As long as AI is not deterministic, you should review the code.",
+ test_linter(),
+ "This sets a bad example that will make it into a trend. As long as AI is not deterministic, you should review the code.",
+ )
+}
+
// SubjunctiveWasToWere
// -if only there was-