Skip to content

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

feat: add lint rule for nonstandard "verse" used as a verb (#2973)

Charlie Tonneslan96061df55b70
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs
index 80578024c..5d25d4138 100644
--- a/harper-core/src/linting/phrase_set_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs
@@ -607,6 +607,22 @@ pub fn lint_group() -> LintGroup {
"Corrects the eggcorn `wreck havoc` to `wreak havoc`, which is the proper term for causing chaos or destruction.",
LintKind::Eggcorn
),
+ "VerseAsVerb" => (
+ &[
+ ("verse against", "play against"),
+ ("versed against", "played against"),
+ ("versing against", "playing against"),
+ ("verses against", "plays against"),
+ ("verse me", "play me"),
+ ("verse him", "play him"),
+ ("verse her", "play her"),
+ ("verse them", "play them"),
+ ("verse you", "play you"),
+ ],
+ "`Verse` is not a verb meaning to compete. Use `play against` or `compete against` instead.",
+ "Corrects the nonstandard use of `verse` as a verb (from `versus`) to standard alternatives.",
+ LintKind::Nonstandard
+ ),
"WroteToRote" => (
&[
("by wrote", "by rote"),
diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs
index a31f55fa3..99624b2bd 100644
--- a/harper-core/src/linting/phrase_set_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs
@@ -1911,6 +1911,40 @@ fn fix_wrecks_havoc() {
);
}
+// VerseAsVerb
+
+#[test]
+fn corrects_verse_against() {
+ assert_suggestion_result(
+ "A game of Morra, with 3 different AI you can verse against.",
+ lint_group(),
+ "A game of Morra, with 3 different AI you can play against.",
+ );
+}
+
+#[test]
+fn corrects_versing_against() {
+ assert_suggestion_result(
+ "This will help when you are versing against a particular boss.",
+ lint_group(),
+ "This will help when you are playing against a particular boss.",
+ );
+}
+
+#[test]
+fn corrects_verse_me() {
+ assert_suggestion_result(
+ "Come verse me in this game.",
+ lint_group(),
+ "Come play me in this game.",
+ );
+}
+
+#[test]
+fn allows_versus() {
+ assert_no_lints("It was red versus blue in the finals.", lint_group());
+}
+
// WroteToRote
#[test]