Skip to content

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

feat(core): added another from #507

Elijah Potterc3b1aa16c293
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index 363727827..580daf379 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -17,7 +17,7 @@ use super::merge_words::MergeWords;
use super::multiple_sequential_pronouns::MultipleSequentialPronouns;
use super::number_suffix_capitalization::NumberSuffixCapitalization;
use super::phrase_corrections::{
- AndThis, Decision, HumanLife, NeedHelp, NoLonger, ThatChallenged, TurnItOff,
+ AndThis, Decision, HumanLife, NeedHelp, NoLonger, OfCourse, ThatChallenged, TurnItOff,
};
use super::plural_conjugate::PluralConjugate;
use super::pronoun_contraction::PronounContraction;
@@ -204,7 +204,8 @@ create_lint_group_config!(
NeedHelp => true,
NoLonger => true,
ThatChallenged => true,
- TurnItOff => true
+ TurnItOff => true,
+ OfCourse => true
);
impl<T: Dictionary + Default> Default for LintGroup<T> {
diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rs
index a7a1aa18e..72186e9f3 100644
--- a/harper-core/src/linting/mod.rs
+++ b/harper-core/src/linting/mod.rs
@@ -61,7 +61,7 @@ pub use number_suffix_capitalization::NumberSuffixCapitalization;
pub use oxford_comma::OxfordComma;
pub use pattern_linter::PatternLinter;
pub use phrase_corrections::{
- AndThis, Decision, HumanLife, NeedHelp, NoLonger, ThatChallenged, TurnItOff,
+ AndThis, Decision, HumanLife, NeedHelp, NoLonger, OfCourse, ThatChallenged, TurnItOff,
};
pub use plural_conjugate::PluralConjugate;
pub use pronoun_contraction::PronounContraction;
diff --git a/harper-core/src/linting/phrase_corrections.rs b/harper-core/src/linting/phrase_corrections.rs
index b3ee9b323..344c06cad 100644
--- a/harper-core/src/linting/phrase_corrections.rs
+++ b/harper-core/src/linting/phrase_corrections.rs
@@ -74,12 +74,13 @@ create_linter_for_phrase!(NoLonger, "no longer", 1);
create_linter_for_phrase!(NeedHelp, "need help", 1);
create_linter_for_phrase!(AndThis, "and this", 1);
create_linter_for_phrase!(Decision, "make a decision", 1);
+create_linter_for_phrase!(OfCourse, "of course", 1);
#[cfg(test)]
mod tests {
use crate::linting::tests::{assert_lint_count, assert_suggestion_result};
- use super::{Decision, TurnItOff};
+ use super::{Decision, OfCourse, TurnItOff};
#[test]
fn turn_it_off_clean_lower() {
@@ -109,4 +110,22 @@ mod tests {
"we should make a decision on this",
);
}
+
+ #[test]
+ fn off_course() {
+ assert_suggestion_result(
+ "Yes, off course we should do that.",
+ OfCourse::default(),
+ "Yes, of course we should do that.",
+ );
+ }
+
+ #[test]
+ fn o_course() {
+ assert_suggestion_result(
+ "Yes, o course we should do that.",
+ OfCourse::default(),
+ "Yes, of course we should do that.",
+ );
+ }
}