Offline, privacy-first grammar checker. Fast, open-source, Rust-powered
feat: add lint rule for flaunt/flout mix-up (#2962)
Charlie Tonneslan8be8bbe327a5
diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rsindex 546c08c02..e06035e7e 100644--- a/harper-core/src/linting/phrase_set_corrections/mod.rs+++ b/harper-core/src/linting/phrase_set_corrections/mod.rs@@ -253,6 +253,30 @@ pub fn lint_group() -> LintGroup {// ConfusedPair??LintKind::WordChoice),+ "FlauntForFlout" => (+ &[+ ("flaunt the rules", "flout the rules"),+ ("flaunts the rules", "flouts the rules"),+ ("flaunted the rules", "flouted the rules"),+ ("flaunting the rules", "flouting the rules"),+ ("flaunt the law", "flout the law"),+ ("flaunts the law", "flouts the law"),+ ("flaunted the law", "flouted the law"),+ ("flaunting the law", "flouting the law"),+ ("flaunt the regulations", "flout the regulations"),+ ("flaunt authority", "flout authority"),+ ("flaunts authority", "flouts authority"),+ ("flaunted authority", "flouted authority"),+ ("flaunting authority", "flouting authority"),+ ("flaunt convention", "flout convention"),+ ("flaunts convention", "flouts convention"),+ ("flaunted convention", "flouted convention"),+ ("flaunting convention", "flouting convention"),+ ],+ "`Flaunt` means to show off. Use `flout` when you mean to openly disregard rules or conventions.",+ "Corrects `flaunt` to `flout` when used with rule-like nouns.",+ LintKind::WordChoice+ ),"FoamAtTheMouth" => (&[("foam out the mouth", "foam at the mouth"),diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rsindex 79784e7c6..afadeff3a 100644--- a/harper-core/src/linting/phrase_set_corrections/tests.rs+++ b/harper-core/src/linting/phrase_set_corrections/tests.rs@@ -755,6 +755,40 @@ fn correct_to_an_extend() {);}+// FlauntForFlout++#[test]+fn corrects_flaunt_the_rules() {+ assert_suggestion_result(+ "Some users flaunt the rules of punctuation.",+ lint_group(),+ "Some users flout the rules of punctuation.",+ );+}++#[test]+fn corrects_flaunted_the_law() {+ assert_suggestion_result(+ "He flaunted the law for personal gain.",+ lint_group(),+ "He flouted the law for personal gain.",+ );+}++#[test]+fn corrects_flaunting_authority() {+ assert_suggestion_result(+ "She was flaunting authority at every turn.",+ lint_group(),+ "She was flouting authority at every turn.",+ );+}++#[test]+fn allows_flaunt_wealth() {+ assert_no_lints("He likes to flaunt his wealth.", lint_group());+}+// FoamAtTheMouth#[test]