From 309719994cdd2e45400923834ed5ca94bfff07fa Mon Sep 17 00:00:00 2001 From: Andrew Dunbar Date: Thu, 11 Dec 2025 18:24:03 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20wreck=20havoc=E2=86=92wreak=20havoc=20(?= =?UTF-8?q?#2321)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/linting/phrase_set_corrections/mod.rs | 65 +++++++++++-------- .../linting/phrase_set_corrections/tests.rs | 38 +++++++++++ 2 files changed, 76 insertions(+), 27 deletions(-) diff --git a/harper-core/src/linting/phrase_set_corrections/mod.rs b/harper-core/src/linting/phrase_set_corrections/mod.rs index 7d9233af..d5784194 100644 --- a/harper-core/src/linting/phrase_set_corrections/mod.rs +++ b/harper-core/src/linting/phrase_set_corrections/mod.rs @@ -252,6 +252,33 @@ pub fn lint_group() -> LintGroup { "`Invest` is traditionally followed by 'in,' not `into.`", LintKind::Usage ), + + // General litotes (double negatives) → direct positive suggestions + "LitotesDirectPositive" => ( + &[ + ("not uncommon", "common"), + ("not unusual", "common"), + ("not insignificant", "significant"), + ("not unimportant", "important"), + ("not unlikely", "likely"), + ("not infrequent", "frequent"), + ("not inaccurate", "accurate"), + ("not unclear", "clear"), + ("not irrelevant", "relevant"), + ("not unpredictable", "predictable"), + ("not inadequate", "adequate"), + ("not unpleasant", "pleasant"), + ("not unreasonable", "reasonable"), + ("not impossible", "possible"), + ("more preferable", "preferable"), + ("not online", "offline"), + ("not offline", "online"), + ], + "Consider the direct form.", + "Offers direct-positive alternatives when double negatives might feel heavy.", + LintKind::Style + ), + "MakeDoWith" => ( &[ ("make due with", "make do with"), @@ -299,33 +326,6 @@ pub fn lint_group() -> LintGroup { "Corrects the eggcorn `piggy bag` to `piggyback`, which is the proper term for riding on someone’s back or using an existing system.", LintKind::Eggcorn ), - - // General litotes (double negatives) → direct positive suggestions - "LitotesDirectPositive" => ( - &[ - ("not uncommon", "common"), - ("not unusual", "common"), - ("not insignificant", "significant"), - ("not unimportant", "important"), - ("not unlikely", "likely"), - ("not infrequent", "frequent"), - ("not inaccurate", "accurate"), - ("not unclear", "clear"), - ("not irrelevant", "relevant"), - ("not unpredictable", "predictable"), - ("not inadequate", "adequate"), - ("not unpleasant", "pleasant"), - ("not unreasonable", "reasonable"), - ("not impossible", "possible"), - ("more preferable", "preferable"), - ("not online", "offline"), - ("not offline", "online"), - ], - "Consider the direct form.", - "Offers direct-positive alternatives when double negatives might feel heavy.", - LintKind::Style - ), - // Redundant degree modifiers on positives (double positives) → base form "RedundantSuperlatives" => ( &[ @@ -338,6 +338,17 @@ pub fn lint_group() -> LintGroup { "Simplifies redundant double positives like `most optimal` to the base form.", LintKind::Redundancy ), + "WreakHavoc" => ( + &[ + ("wreck havoc", "wreak havoc"), + ("wrecked havoc", "wreaked havoc"), + ("wrecking havoc", "wreaking havoc"), + ("wrecks havoc", "wreaks havoc"), + ], + "Did you mean `wreak havoc`?", + "Corrects the eggcorn `wreck havoc` to `wreak havoc`, which is the proper term for causing chaos or destruction.", + LintKind::Eggcorn + ) }); add_many_to_many_mappings!(group, { diff --git a/harper-core/src/linting/phrase_set_corrections/tests.rs b/harper-core/src/linting/phrase_set_corrections/tests.rs index b014be93..38b756c5 100644 --- a/harper-core/src/linting/phrase_set_corrections/tests.rs +++ b/harper-core/src/linting/phrase_set_corrections/tests.rs @@ -832,8 +832,46 @@ fn correct_passer_bys_hyphen() { // Piggyback // -none- +// WreakHavoc + // Many to many tests +#[test] +fn fix_wreck_havoc() { + assert_suggestion_result( + "Tables with a \".\" in the name wreck havoc with the system", + lint_group(), + "Tables with a \".\" in the name wreak havoc with the system", + ); +} + +#[test] +fn fix_wrecked_havoc() { + assert_suggestion_result( + "It would have been some weird local configuration of LO that wrecked havoc.", + lint_group(), + "It would have been some weird local configuration of LO that wreaked havoc.", + ); +} + +#[test] +fn fix_wrecking_havoc() { + assert_suggestion_result( + "Multi-line edit is wrecking havoc with indention", + lint_group(), + "Multi-line edit is wreaking havoc with indention", + ); +} + +#[test] +fn fix_wrecks_havoc() { + assert_suggestion_result( + "Small POC using rust with ptrace that wrecks havoc on msync", + lint_group(), + "Small POC using rust with ptrace that wreaks havoc on msync", + ); +} + // AwaitFor #[test]