Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat(core): create linter for "special attention"
Elijah Potterbf9e631c299b
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rsindex d97679fd3..f54273131 100644--- a/harper-core/src/linting/lint_group.rs+++ b/harper-core/src/linting/lint_group.rs@@ -18,8 +18,8 @@ use super::multiple_sequential_pronouns::MultipleSequentialPronouns;use super::number_suffix_capitalization::NumberSuffixCapitalization;use super::phrase_corrections::{AndAlike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, HumanLife, HungerPang,- LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SupposeTo,- ThatChallenged, TurnItOff,+ LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SpecialAttention,+ SupposeTo, ThatChallenged, TurnItOff,};use super::plural_conjugate::PluralConjugate;use super::pronoun_contraction::PronounContraction;@@ -217,7 +217,8 @@ create_lint_group_config!(LetAlone => true,LoAndBehold => true,SneakingSuspicion => true,- SupposeTo => true+ SupposeTo => true,+ SpecialAttention => true,);impl<T: Dictionary + Default> Default for LintGroup<T> {diff --git a/harper-core/src/linting/matcher.rs b/harper-core/src/linting/matcher.rsindex 71ffb8257..aff346612 100644--- a/harper-core/src/linting/matcher.rs+++ b/harper-core/src/linting/matcher.rs@@ -102,7 +102,6 @@ impl Matcher {// This match list needs to be automatically expanded instead of explicitly// defined like it is now.let mut triggers = pt! {- "spacial","attention" => "special attention","wellbeing" => "well-being","hashtable" => "hash table","hashmap" => "hash map",diff --git a/harper-core/src/linting/mod.rs b/harper-core/src/linting/mod.rsindex d30137ea8..139a82a09 100644--- a/harper-core/src/linting/mod.rs+++ b/harper-core/src/linting/mod.rs@@ -67,8 +67,8 @@ pub use oxford_comma::OxfordComma;pub use pattern_linter::PatternLinter;pub use phrase_corrections::{AndAlike, BadRap, BatedBreath, BeckAndCall, ChangeTack, EnMasse, HumanLife, HungerPang,- LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SupposeTo,- ThatChallenged, TurnItOff,+ LetAlone, LoAndBehold, NeedHelp, NoLonger, OfCourse, SneakingSuspicion, SpecialAttention,+ SupposeTo, 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.rsindex 69cec4f50..6dddd3e4f 100644--- a/harper-core/src/linting/phrase_corrections.rs+++ b/harper-core/src/linting/phrase_corrections.rs@@ -84,6 +84,7 @@ create_linter_for_phrase!(LetAlone, "let alone", 1);create_linter_for_phrase!(LoAndBehold, "lo and behold", 2);create_linter_for_phrase!(SneakingSuspicion, "sneaking suspicion", 3);create_linter_for_phrase!(SupposeTo, "suppose to", 1);+create_linter_for_phrase!(SpecialAttention, "special attention", 1);#[cfg(test)]mod tests {@@ -91,7 +92,7 @@ mod tests {use super::{BadRap, BatedBreath, ChangeTack, EnMasse, HungerPang, LetAlone, LoAndBehold, OfCourse,- SneakingSuspicion, SupposeTo, TurnItOff,+ SneakingSuspicion, SpecialAttention, SupposeTo, TurnItOff,};#[test]@@ -185,4 +186,13 @@ mod tests {fn supposed_to() {assert_suggestion_result("supposed to", SupposeTo::default(), "suppose to");}++ #[test]+ fn spacial_attention() {+ assert_suggestion_result(+ "spacial attention",+ SpecialAttention::default(),+ "special attention",+ );+ }}