Skip to content

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

fix: add ofcourse→of course phrase correction (#1570)

Andrew Dunbar286497b088aa
diff --git a/harper-core/src/linting/of_course.rs b/harper-core/src/linting/of_course.rs
index 7c5402fe7..566332c09 100644
--- a/harper-core/src/linting/of_course.rs
+++ b/harper-core/src/linting/of_course.rs
@@ -1,3 +1,8 @@
+//! Corrects "of curse/corse" to "of course" while ignoring phrases like "kind of curse".
+//!
+//! See also:
+//! - `OfCourse` in `phrase_corrections` for "off course" / "o course" / "ofcourse" → "of course" corrections.
+
use crate::expr::Expr;
use crate::expr::SequenceExpr;
use crate::{
diff --git a/harper-core/src/linting/phrase_corrections/mod.rs b/harper-core/src/linting/phrase_corrections/mod.rs
index de8ec731b..16107ab04 100644
--- a/harper-core/src/linting/phrase_corrections/mod.rs
+++ b/harper-core/src/linting/phrase_corrections/mod.rs
@@ -640,10 +640,11 @@ pub fn lint_group() -> LintGroup {
"Corrects `no to` to `not to`, ensuring proper negation."
),
"OfCourse" => (
- ["off course", "o course"],
- ["Of course"],
+ // See also: `of_course.rs` for "of curse/corse" → "of course" corrections
+ ["off course", "o course", "ofcourse"],
+ ["of course"],
"Did you mean `of course`?",
- "Detects the non‐idiomatic phrase `off course` and suggests the correct form `of course`."
+ "Detects the common mistake `off course` and suggests the correct form `of course`."
),
"OffTheCuff" => (
["off the cuff"],
diff --git a/harper-core/src/linting/phrase_corrections/tests.rs b/harper-core/src/linting/phrase_corrections/tests.rs
index dd31f16de..0f36c52c4 100644
--- a/harper-core/src/linting/phrase_corrections/tests.rs
+++ b/harper-core/src/linting/phrase_corrections/tests.rs
@@ -870,6 +870,7 @@ fn detect_nerve_racking_no_hyphen() {
// -none-
// OfCourse
+// See also: tests in `of_course.rs` for "of curse/corse" → "of course" corrections
#[test]
fn off_course() {
assert_suggestion_result(
@@ -888,6 +889,15 @@ fn o_course() {
);
}
+#[test]
+fn ofcourse() {
+ assert_suggestion_result(
+ "Ofcourse, I like other languages.. uzulla has 183 repositories available.",
+ lint_group(),
+ "Of course, I like other languages.. uzulla has 183 repositories available.",
+ );
+}
+
// OffTheCuff
// -none-