Skip to content

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

feat: subjective/objective pronoun→subject/object pronoun (#4548)

Andrew Dunbared6938763464
diff --git a/harper-core/default_config.json b/harper-core/default_config.json
index 1b7261d02..f8d95a1f4 100644
--- a/harper-core/default_config.json
+++ b/harper-core/default_config.json
@@ -5809,6 +5809,13 @@
"label": "Statute Of Limitations"
}
},
+ {
+ "Bool": {
+ "name": "SubjectAndObjectPronoun",
+ "state": true,
+ "label": "SubjectAndObjectPronoun"
+ }
+ },
{
"Bool": {
"name": "SuchShame",
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 809f4bd79..c2011f73e 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -689,6 +689,17 @@ pub fn lint_group() -> LintGroup {
"Corrects `set up a bad example` to `set a bad example`.",
LintKind::Usage
),
+ "SubjectAndObjectPronoun" => (
+ &[
+ ("subjective pronoun", "subject pronoun"),
+ ("subjective pronouns", "subject pronouns"),
+ ("objective pronoun", "object pronoun"),
+ ("objective pronouns", "object pronouns"),
+ ],
+ "`Subject -` and `object pronoun` are much more common than `subjective -` and `objective -`.",
+ "Standardizes `subjective pronoun` and `objective pronoun` to the more common `subject -` and `object -`.",
+ 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 68a34547a..f5fd3745c 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
@@ -2212,6 +2212,45 @@ fn fix_sets_up_a_bad_example() {
)
}
+// SubjectAndObjectPronoun
+
+#[test]
+fn fix_subjective_pronoun() {
+ assert_suggestion_result(
+ "Gets the subjective pronoun with \"are\"/\"is\" contraction.",
+ test_linter(),
+ "Gets the subject pronoun with \"are\"/\"is\" contraction.",
+ );
+}
+
+#[test]
+fn fix_objective_pronoun() {
+ assert_suggestion_result(
+ "If my subjective pronoun is he , then this might be macro expanded as he entered the room",
+ test_linter(),
+ "If my subject pronoun is he , then this might be macro expanded as he entered the room",
+ );
+}
+
+#[test]
+#[ignore = "Fails due to #3741"]
+fn fix_objective_pronoun_title_case() {
+ assert_suggestion_result(
+ "Objective Pronouns Examples of Subjects and Objects in a Sentence",
+ test_linter(),
+ "Object Pronouns Examples of Subjects and Objects in a Sentence",
+ );
+}
+
+#[test]
+fn fix_subjective_and_objective_pronouns() {
+ assert_suggestion_result(
+ "To address these questions, we analyze subjective pronouns (he, she) and objective pronouns (him, her).",
+ test_linter(),
+ "To address these questions, we analyze subject pronouns (he, she) and object pronouns (him, her).",
+ );
+}
+
// SubjunctiveWasToWere
// -if only there was-