Skip to content

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

feat: commitment toward(s) → commitment to (#2948)

Andrew Dunbar8942fadf098a
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index e586c44b8..d9727a1a6 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -554,6 +554,15 @@ pub fn lint_group() -> LintGroup {
"Suggests using either `await` or `wait for` but not both, as they express the same meaning.",
LintKind::Redundancy
),
+ "CommitmentTo" => (
+ &[
+ (&["commitment toward", "commitment towards"], &["commitment to"]),
+ (&["commitments toward", "commitments towards"], &["commitments to"]),
+ ],
+ "The correct preposition to use with `commitment` is `to`, not `toward` or `towards`.",
+ "Corrects `commitment toward/towards` to `commitment to`.",
+ LintKind::Usage
+ ),
"Copyright" => (
&[
(&["copywrite"], &["copyright"]),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index 33018448e..c7c47c03a 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -1796,6 +1796,44 @@ fn correct_awaited_for() {
);
}
+// CommitmentTo
+
+#[test]
+fn singular_towards() {
+ assert_suggestion_result(
+ "the platform's focus on multimedia projects and VideoLAN's long history of commitment towards free and open multimedia",
+ lint_group(),
+ "the platform's focus on multimedia projects and VideoLAN's long history of commitment to free and open multimedia",
+ );
+}
+
+#[test]
+fn plural_towards() {
+ assert_suggestion_result(
+ "the signer may express multiple commitments towards the data objects",
+ lint_group(),
+ "the signer may express multiple commitments to the data objects",
+ );
+}
+
+#[test]
+fn singular_toward() {
+ assert_suggestion_result(
+ "This document outlines the current level of commitment toward Linux distributions and packaging formats.",
+ lint_group(),
+ "This document outlines the current level of commitment to Linux distributions and packaging formats.",
+ );
+}
+
+#[test]
+fn plural_toward() {
+ assert_suggestion_result(
+ "... and are expected to inform parties in updating their commitments toward the Paris Agreement",
+ lint_group(),
+ "... and are expected to inform parties in updating their commitments to the Paris Agreement",
+ );
+}
+
// Copyright
#[test]