Skip to content

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

feat: take/claim/assume responsibility of→responsibility for (#2880)

Andrew Dunbard648668c8086
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 4d1c3540b..d755a786e 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -420,6 +420,26 @@ pub fn lint_group() -> LintGroup {
"Simplifies redundant double positives like `most optimal` to the base form.",
LintKind::Redundancy
),
+ "ResponsibilityFor" => (
+ &[
+ ("take responsibility of", "take responsibility for"),
+ ("took responsibility of", "took responsibility for"),
+ ("taken responsibility of", "taken responsibility for"),
+ ("taking responsibility of", "taking responsibility for"),
+ ("takes responsibility of", "takes responsibility for"),
+ ("assume responsibility of", "assume responsibility for"),
+ ("assumed responsibility of", "assumed responsibility for"),
+ ("assuming responsibility of", "assuming responsibility for"),
+ ("assumes responsibility of", "assumes responsibility for"),
+ ("claim responsibility of", "claim responsibility for"),
+ ("claimed responsibility of", "claimed responsibility for"),
+ ("claiming responsibility of", "claiming responsibility for"),
+ ("claims responsibility of", "claims responsibility for"),
+ ],
+ "The correct preposition is `for`, not `of`.",
+ "Corrects `take/assume/claim responsibility of` to `take/assume/claim responsibility for`.",
+ LintKind::Usage
+ ),
"ScapeGoat" => (
&[
("an escape goat", "a scapegoat"),
@@ -430,23 +450,6 @@ pub fn lint_group() -> LintGroup {
"Corrects `scape goat` to `scapegoat`, which is the proper term for a person blamed for others' failures.",
LintKind::Eggcorn
),
- "SubjunctiveWasToWere" => (
- &[
- ("if only there was", "if only there were"),
- ("if only i was", "if only i were"),
- ("if only he was", "if only he were"),
- ("if only she was", "if only she were"),
- ("if only it was", "if only it were"),
- ("i wish there was", "i wish there were"),
- ("i wish i was", "i wish i were"),
- ("i wish he was", "i wish he were"),
- ("i wish she was", "i wish she were"),
- ("i wish it was", "i wish it were")
- ],
- "Use the subjunctive mood with `if only` or `I wish`. The correct form is `were`, not `was`.",
- "Ensures proper use of the subjunctive mood in counterfactual conditional statements starting with `if only` or `I wish`.",
- LintKind::Grammar
- ),
"SeamToSeem" => (
&[
("seam to be", "seem to be"),
@@ -472,6 +475,23 @@ pub fn lint_group() -> LintGroup {
"Corrects `seam` to `seem` when used as a verb meaning `to appear` or `to give the impression`.",
LintKind::Spelling
),
+ "SubjunctiveWasToWere" => (
+ &[
+ ("if only there was", "if only there were"),
+ ("if only i was", "if only i were"),
+ ("if only he was", "if only he were"),
+ ("if only she was", "if only she were"),
+ ("if only it was", "if only it were"),
+ ("i wish there was", "i wish there were"),
+ ("i wish i was", "i wish i were"),
+ ("i wish he was", "i wish he were"),
+ ("i wish she was", "i wish she were"),
+ ("i wish it was", "i wish it were")
+ ],
+ "Use the subjunctive mood with `if only` or `I wish`. The correct form is `were`, not `was`.",
+ "Ensures proper use of the subjunctive mood in counterfactual conditional statements starting with `if only` or `I wish`.",
+ LintKind::Grammar
+ ),
"WreakHavoc" => (
&[
("wreck havoc", "wreak havoc"),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index c4b2ba064..e533fdcd1 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -1120,134 +1120,151 @@ fn fix_peaks() {
// RedundantSuperlatives
// -none-
-// ScapeGoat
+// ResponsibilityFor
#[test]
-fn fix_an_escape_goat() {
+fn fix_take() {
assert_suggestion_result(
- "I see too many times the cable and ps thingy being used as an escape goat.",
+ "Is anyone wanting to step up and take responsibility of this library, or should I put it in EOL and redirect to another tool? ",
lint_group(),
- "I see too many times the cable and ps thingy being used as a scapegoat.",
+ "Is anyone wanting to step up and take responsibility for this library, or should I put it in EOL and redirect to another tool? ",
);
}
#[test]
-fn fix_escape_goat() {
+fn fix_taken() {
assert_suggestion_result(
- "It helps shift the reason for the failure on to what the manager did not do (making them the escape goat when it fails).",
+ "if it had only taken responsibility of the manifest/info additions and extensionsID it would have made our life easier",
lint_group(),
- "It helps shift the reason for the failure on to what the manager did not do (making them the scapegoat when it fails).",
+ "if it had only taken responsibility for the manifest/info additions and extensionsID it would have made our life easier",
);
}
#[test]
-fn fix_escape_goats() {
+fn fix_takes() {
assert_suggestion_result(
- "People might be using Americans as escape goats for this, but these mishearings are becoming as common as a bowl in a china shop!",
+ "If I have a message that i want to encode, who takes responsibility of pointers?",
lint_group(),
- "People might be using Americans as scapegoats for this, but these mishearings are becoming as common as a bowl in a china shop!",
+ "If I have a message that i want to encode, who takes responsibility for pointers?",
);
}
-// SubjunctiveWasToWere
+#[test]
+fn fix_taking() {
+ assert_suggestion_result(
+ "This issue is about taking responsibility of the feature area auto indentation and start solving the bugs in the feature area.",
+ lint_group(),
+ "This issue is about taking responsibility for the feature area auto indentation and start solving the bugs in the feature area.",
+ );
+}
-// -if only there was-
#[test]
-fn if_only_there_was() {
+fn fix_took() {
assert_suggestion_result(
- "if only there was an endpoint do to so",
+ "If the driver took responsibility of the locking, it could let these HTTP calls happen in parallel",
lint_group(),
- "if only there were an endpoint do to so",
+ "If the driver took responsibility for the locking, it could let these HTTP calls happen in parallel",
);
}
-// -if only I-
#[test]
-fn if_only_i_was() {
+fn fix_assume() {
assert_suggestion_result(
- "Oh If only I was that clever !!",
+ "it's a relatively big chunk of behavior to assume responsibility of",
lint_group(),
- "Oh If only I were that clever !!",
+ "it's a relatively big chunk of behavior to assume responsibility for",
);
}
-// -if only he-
#[test]
-fn if_only_he_was() {
+fn fix_assumed() {
assert_suggestion_result(
- "If only he was kind enough to attempt to contact me in private first",
+ "and assumed responsibility of project managing the transition of Barclays",
lint_group(),
- "If only he were kind enough to attempt to contact me in private first",
+ "and assumed responsibility for project managing the transition of Barclays",
);
}
-// -if only she-
#[test]
-fn if_only_she_was() {
+fn fix_assumes() {
assert_suggestion_result(
- "If only she was right.",
+ "It means that the core development team assumes responsibility of the module",
lint_group(),
- "If only she were right.",
+ "It means that the core development team assumes responsibility for the module",
);
}
-// -it-
#[test]
-fn if_only_it_was() {
+fn fix_assuming() {
assert_suggestion_result(
- "if only it was accessible via USB connection - hint hint",
+ "The point of extract is essentially that you're assuming responsibility of maintenance for that version of the formula.",
lint_group(),
- "if only it were accessible via USB connection - hint hint",
+ "The point of extract is essentially that you're assuming responsibility for maintenance for that version of the formula.",
);
}
-// -I wish there was-
#[test]
-fn i_wish_there_was() {
+fn fix_claim() {
assert_suggestion_result(
- "I wish there was a keyboard shortcut or something that was \"bring back the suggestion you just made in the last 3 seconds\".",
+ "so it doesn't need to claim responsibility of the reappearing containers lifecycle",
lint_group(),
- "I wish there were a keyboard shortcut or something that was \"bring back the suggestion you just made in the last 3 seconds\".",
+ "so it doesn't need to claim responsibility for the reappearing containers lifecycle",
);
}
-// -I wish I was-
#[test]
-fn i_wish_i_was() {
+fn fix_claimed() {
assert_suggestion_result(
- "I wish I was as smart as I think I am.",
+ "a group called The Impact Team had claimed responsibility of the data breach",
lint_group(),
- "I wish I were as smart as I think I am.",
+ "a group called The Impact Team had claimed responsibility for the data breach",
);
}
-// -I wish he was-
#[test]
-fn i_wish_he_was() {
+fn fix_claiming() {
assert_suggestion_result(
- "However I wish he was that smart about ARM chips present in the current mobile devices.",
+ "I feel that there should be some other way of claiming responsibility of the promise's continuation.",
lint_group(),
- "However I wish he were that smart about ARM chips present in the current mobile devices.",
+ "I feel that there should be some other way of claiming responsibility for the promise's continuation.",
);
}
-// -I wish she was-
#[test]
-fn i_wish_she_was() {
+fn fix_claims() {
assert_suggestion_result(
- "I wish she was more accepting of her own interests.",
+ "yet the Lord claims responsibility of those boundaries",
lint_group(),
- "I wish she were more accepting of her own interests.",
+ "yet the Lord claims responsibility for those boundaries",
);
}
-// -I wish it was-
+// ScapeGoat
+
#[test]
-fn i_wish_it_was() {
+fn fix_an_escape_goat() {
assert_suggestion_result(
- "but I wish it was more friendly to existing ecosystems",
+ "I see too many times the cable and ps thingy being used as an escape goat.",
lint_group(),
- "but I wish it were more friendly to existing ecosystems",
+ "I see too many times the cable and ps thingy being used as a scapegoat.",
+ );
+}
+
+#[test]
+fn fix_escape_goat() {
+ assert_suggestion_result(
+ "It helps shift the reason for the failure on to what the manager did not do (making them the escape goat when it fails).",
+ lint_group(),
+ "It helps shift the reason for the failure on to what the manager did not do (making them the scapegoat when it fails).",
+ );
+}
+
+#[test]
+fn fix_escape_goats() {
+ assert_suggestion_result(
+ "People might be using Americans as escape goats for this, but these mishearings are becoming as common as a bowl in a china shop!",
+ lint_group(),
+ "People might be using Americans as scapegoats for this, but these mishearings are becoming as common as a bowl in a china shop!",
);
}
@@ -1433,6 +1450,108 @@ fn fix_everyone_seams() {
);
}
+// SubjunctiveWasToWere
+
+// -if only there was-
+#[test]
+fn if_only_there_was() {
+ assert_suggestion_result(
+ "if only there was an endpoint do to so",
+ lint_group(),
+ "if only there were an endpoint do to so",
+ );
+}
+
+// -if only I-
+#[test]
+fn if_only_i_was() {
+ assert_suggestion_result(
+ "Oh If only I was that clever !!",
+ lint_group(),
+ "Oh If only I were that clever !!",
+ );
+}
+
+// -if only he-
+#[test]
+fn if_only_he_was() {
+ assert_suggestion_result(
+ "If only he was kind enough to attempt to contact me in private first",
+ lint_group(),
+ "If only he were kind enough to attempt to contact me in private first",
+ );
+}
+
+// -if only she-
+#[test]
+fn if_only_she_was() {
+ assert_suggestion_result(
+ "If only she was right.",
+ lint_group(),
+ "If only she were right.",
+ );
+}
+
+// -it-
+#[test]
+fn if_only_it_was() {
+ assert_suggestion_result(
+ "if only it was accessible via USB connection - hint hint",
+ lint_group(),
+ "if only it were accessible via USB connection - hint hint",
+ );
+}
+
+// -I wish there was-
+#[test]
+fn i_wish_there_was() {
+ assert_suggestion_result(
+ "I wish there was a keyboard shortcut or something that was \"bring back the suggestion you just made in the last 3 seconds\".",
+ lint_group(),
+ "I wish there were a keyboard shortcut or something that was \"bring back the suggestion you just made in the last 3 seconds\".",
+ );
+}
+
+// -I wish I was-
+#[test]
+fn i_wish_i_was() {
+ assert_suggestion_result(
+ "I wish I was as smart as I think I am.",
+ lint_group(),
+ "I wish I were as smart as I think I am.",
+ );
+}
+
+// -I wish he was-
+#[test]
+fn i_wish_he_was() {
+ assert_suggestion_result(
+ "However I wish he was that smart about ARM chips present in the current mobile devices.",
+ lint_group(),
+ "However I wish he were that smart about ARM chips present in the current mobile devices.",
+ );
+}
+
+// -I wish she was-
+#[test]
+fn i_wish_she_was() {
+ assert_suggestion_result(
+ "I wish she was more accepting of her own interests.",
+ lint_group(),
+ "I wish she were more accepting of her own interests.",
+ );
+}
+
+// -I wish it was-
+#[test]
+fn i_wish_it_was() {
+ assert_suggestion_result(
+ "but I wish it was more friendly to existing ecosystems",
+ lint_group(),
+ "but I wish it were more friendly to existing ecosystems",
+ );
+}
+
// WreakHavoc
#[test]