use crate::linting::LintKind;

use super::{LintGroup, MapPhraseSetLinter};

#[cfg(test)]
mod tests;

/// Produce a [`LintGroup`] that looks for errors in sets of common phrases.
pub fn lint_group() -> LintGroup {
    let mut group = LintGroup::default();

    // Each correction pair has a single bad form and a single correct form.
    macro_rules! add_1_to_1_mappings {
        ($group:expr, {
            $($name:expr => ($input_correction_pairs:expr, $message:expr, $description:expr $(, $lint_kind:expr)?)),+ $(,)?
        }) => {
            $(
                $group.add_chunk_expr_linter(
                    $name,
                    Box::new(
                        MapPhraseSetLinter::one_to_one(
                            $input_correction_pairs,
                            $message,
                            $description,
                            None$(.or(Some($lint_kind)))?,
                        ),
                    ),
                );
            )+
        };
    }

    // Each correction pair has multiple bad forms and multiple correct forms.
    macro_rules! add_many_to_many_mappings {
        ($group:expr, {
            $($name:expr => ($input_correction_multi_pairs:expr, $message:expr, $description:expr $(, $lint_kind:expr)?)),+ $(,)?
        }) => {
            $(
                $group.add_chunk_expr_linter(
                    $name,
                    Box::new(
                        MapPhraseSetLinter::many_to_many(
                            $input_correction_multi_pairs,
                            $message,
                            $description,
                            None$(.or(Some($lint_kind)))?,
                        ),
                    ),
                );
            )+
        };
    }

    add_1_to_1_mappings!(group, {
        "Ado" => (
            &[
                ("further adieu", "further ado"),
                ("much adieu", "much ado"),
            ],
            "Don't confuse the French/German `adieu`, meaning `farewell`, with the English `ado`, meaning `fuss`.",
            "Corrects `adieu` to `ado`.",
            LintKind::Eggcorn
        ),
        "ArgumentToBeMade" => (
            &[
                ("argument to be said", "argument to be made"),
                ("arguments to be said", "arguments to be made"),
            ],
            "The phrase `argument to be made` is correct.",
            "Corrects `argument to be said` to `argument to be made`.",
            LintKind::Usage
        ),
        "Bollocks" => (
            &[
                ("bullocks!", "bollocks!"),
                ("complete bullocks", "complete bollocks"),
                ("dogs bullocks", "dogs bollocks"),
                ("dog's bullocks", "dog's bollocks"),
                ("is bullocks", "is bollocks"),
                ("it's bullocks", "it's bollocks"),
                ("its bullocks", "its bollocks"),
                ("such bullocks", "such bollocks"),
                ("that's bullocks", "that's bollocks"),
                ("thats bullocks", "thats bollocks"),
                ("total bullocks", "total bollocks"),
                ("utter bullocks", "utter bollocks"),
                ("was bullocks", "was bollocks"),
                ("what bullocks", "what bollocks"),
            ],
            "The slang word for `nonsense` is `bollocks`. `Bullocks` are male cattle.",
            "Corrects `bullocks` to `bollocks` when the meaning is `nonsense`.",
            LintKind::Spelling
        ),
        "ChampAtTheBit" => (
            &[
                ("chomp at the bit", "champ at the bit"),
                ("chomped at the bit", "champed at the bit"),
                ("chomping at the bit", "champing at the bit"),
                ("chomps at the bit", "champs at the bit"),
            ],
            "The correct idiom is `champ at the bit`.",
            "Corrects `chomp at the bit` to the idiom `champ at the bit`, which has an equestrian origin referring to the way an anxious horse grinds its teeth against the metal part of the bridle.",
            LintKind::Eggcorn
        ),
        "ClientOrServerSide" => (
            &[
                ("client's side", "client-side"),
                ("server's side", "server-side"),
            ],
            "`Client-side` and `server-side` do not use an apostrophe.",
            "Corrects extraneous apostrophe in `client's side` and `server's side`.",
            LintKind::Punctuation
        ),
        "Combinate" => (
            &[
                ("combinate", "combine"),
                ("combinated", "combined"),
                ("combinating", "combining"),
                ("combinates", "combines"),
            ],
            "Did you mean `combine` rather than the nonstandard `combinate`?",
            "Suggests replacing the nonstandard verb `combinate` with the standard `combine`.",
            LintKind::Nonstandard
        ),
        "CompulseToCompel" => (
            &[
                ("compulse", "compel"),
                ("compulsed", "compelled"),
                ("compulses", "compels"),
                ("compulsing", "compelling"),
            ],
            "Did you mean `compel` rather than the obsolete or archaic (and non-standard) `compulse`?",
            "Suggests replacing the obsolete or archaic verb `compulse` with the standard `compel`.",
            LintKind::Nonstandard
        ),
        "ConfirmThat" => (
            &[
                ("conform that", "confirm that"),
                ("conformed that", "confirmed that"),
                ("conforms that", "confirms that"),
                // Note: false positives in this inflection:
                // "is there any example of a case that isn't fully conforming that is supported today?"
                ("conforming that", "confirming that"),
            ],
            "Did you mean `confirm` rather than `conform`?",
            "Corrects `conform` typos to `confirm`.",
            LintKind::Typo
        ),
        "ConstituteAs" => (
            &[
                ("constitute as", "constitute"),
                ("constituted as", "constituted"),
                ("constitutes as", "constitutes"),
                ("constituting as", "constituting"),
            ],
            "`As` is extraneous after forms of `constitute`.",
            "Removes extraneous `as` after the verb `constitute`.",
            LintKind::Usage
        ),
        "DefiniteArticle" => (
            &[
                ("definitive article", "definite article"),
                ("definitive articles", "definite articles")
            ],
            "The correct term for `the` is `definite article`.",
            "The name of the word `the` is `definite article`.",
            LintKind::Usage
        ),
        "DigestiveTract" => (
            &[
                ("digestive track", "digestive tract"),
                ("digestive tracks", "digestive tracts"),
            ],
            "The correct term is digestive `tract`.",
            "Corrects `digestive track` to `digestive tract`.",
            LintKind::WordChoice
        ),
        "Discuss" => (
            &[
                ("discuss about", "discuss"),
                ("discussed about", "discussed"),
                ("discusses about", "discusses"),
                ("discussing about", "discussing"),
            ],
            "`About` is redundant",
            "Removes unnecessary `about` after `discuss`.",
            // or maybe Redundancy?
            LintKind::Usage
        ),
        "DoesOrDose" => (
            &[
                // Negatives
                ("dose not", "does not"),
                // Pronouns
                ("he dose", "he does"),
                ("it dose", "it does"),
                ("she dose", "she does"),
                ("someone dose", "someone does"),
                // Interrogatives
                ("how dose", "how does"),
                ("when dose", "when does"),
                ("where dose", "where does"),
                ("who dose", "who does"),
                ("why dose", "why does"),
            ],
            "This may be a typo for `does`.",
            "Tries to correct typos of `dose` to `does`.",
            LintKind::Typo
        ),
        "ExpandAlgorithm" => (
            &[
                ("algo", "algorithm"),
                ("algos", "algorithms"),
            ],
            "Use `algorithm` instead of `algo`",
            "Expands the abbreviation `algo` to the full word `algorithm` for clarity.",
            LintKind::Style
        ),
        "ExpandArgument" => (
            &[
                ("arg", "argument"),
                ("args", "arguments"),
            ],
            "Use `argument` instead of `arg`",
            "Expands the abbreviation `arg` to the full word `argument` for clarity.",
            LintKind::Style
        ),
        "ExpandDependencies" => (
            &[
                ("dep", "dependency"),
                ("deps", "dependencies"),
            ],
            "Use `dependencies` instead of `deps`",
            "Expands the abbreviation `deps` to the full word `dependencies` for clarity.",
            LintKind::Style
        ),
        "ExpandDereference" => (
            &[
                ("deref", "dereference"),
                ("derefs", "dereferences"),
            ],
            "Use `dereference` instead of `deref`",
            "Expands the abbreviation `deref` to the full word `dereference` for clarity.",
            LintKind::Style
        ),
        "ExpandDirectory" => (
            &[
                ("dir", "directory"),
                ("dirs", "directories")
            ],
            "Use `directory` instead of `dir`",
            "Expands the abbreviation `dir` to the full word `directory` for clarity.",
            LintKind::Style
        ),
        "ExpandNotification" => (
            &[
                ("notif", "notification"),
                ("notifs", "notifications"),
            ],
            "Use `notification` instead of `notif`",
            "Expands the abbreviation `notif` to the full word `notification` for clarity.",
            LintKind::Style
        ),
        "ExpandParameter" => (
            &[
                ("param", "parameter"),
                ("params", "parameters"),
            ],
            "Use `parameter` instead of `param`",
            "Expands the abbreviation `param` to the full word `parameter` for clarity.",
            LintKind::Style
        ),
        "ExpandPointer" => (
            &[
                ("ptr", "pointer"),
                ("ptrs", "pointers"),
            ],
            "Use `pointer` instead of `ptr`",
            "Expands the abbreviation `ptr` to the full word `pointer` for clarity.",
            LintKind::Style
        ),
        "ExpandStandardInputAndOutput" => (
            &[
                ("stdin", "standard input"),
                ("stdout", "standard output"),
                ("stderr", "standard error"),
            ],
            "Use `standard input`, `standard output`, and `standard error` instead of `stdin`, `stdout`, and `stderr`",
            "Expands the abbreviations `stdin`, `stdout`, and `stderr` to the full words `standard input`, etc. for clarity.",
            LintKind::Style
        ),
        "ExpandVulnerability" => (
            &[
                ("vuln", "vulnerability"),
                ("vulns", "vulnerabilities"),
            ],
            "Use `vulnerability` instead of `vuln`",
            "Expands the abbreviation `vuln` to the full word `vulnerability` for clarity.",
            LintKind::Style
        ),
        "ExplanationMark" => (
            &[
                ("explanation mark", "exclamation mark"),
                ("explanation marks", "exclamation marks"),
                ("explanation point", "exclamation point"),
            ],
            "The correct names for the `!` punctuation are `exclamation mark` and `exclamation point`.",
            "Corrects the eggcorn `explanation mark/point` to `exclamation mark/point`.",
            LintKind::Usage
        ),
        "ExtendOrExtent" => (
            &[
                ("a certain extend", "a certain extent"),
                ("to an extend", "to an extent"),
                ("to some extend", "to some extent"),
                ("to the extend that", "to the extent that")
            ],
            "Use `extent` for the noun and `extend` for the verb.",
            "Corrects `extend` to `extent` when the context is a noun.",
            // 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"),
                ("foamed out the mouth", "foamed at the mouth"),
                ("foaming out the mouth", "foaming at the mouth"),
                ("foams out the mouth", "foams at the mouth"),
            ],
            "The correct idiom is `foam at the mouth`.",
            "Corrects the idiom `foam out the mouth` to the standard `foam at the mouth`.",
            LintKind::Nonstandard
        ),
        "FootTheBill" => (
            &[
                ("flip the bill", "foot the bill"),
                ("flipped the bill", "footed the bill"),
                ("flipping the bill", "footing the bill"),
                ("flips the bill", "foots the bill"),
            ],
            "The standard expression is `foot the bill`.",
            "Corrects `flip the bill` to `foot the bill`.",
            LintKind::Nonstandard
        ),
        "GetUsedTo" => (
            &[
                ("get used of", "get used to"),
                ("gets used of", "gets used to"),
                ("getting used of", "getting used to"),
                ("got used of", "got used to"),
                ("gotten used of", "gotten used to"),
            ],
            "Use `used to` instead of `used of`.",
            "Corrects `used of` to `used to`.",
            LintKind::Usage
        ),
        "GrindToAHalt" => (
            &[
                ("grind to halt", "grind to a halt"),
                ("grinding to halt", "grinding to a halt"),
                ("grinds to halt", "grinds to a halt"),
                ("ground to halt", "ground to a halt"),
            ],
            "You are missing the indefinite article `a` before `halt`.",
            "Corrects the idiom `grind to halt` to the standard `grind to a halt`.",
            LintKind::Nonstandard
        ),
        "HavePassed" => (
            &[
                ("had past", "had passed"),
                ("has past", "has passed"),
                ("have past", "have passed"),
                ("having past", "having passed"),
            ],
            "Did you mean the verb `passed`?",
            "Suggests `past` for `passed` in case a verb was intended.",
            // ConfusedPair?
            LintKind::WordChoice
        ),
        "HitTheNailOnTheHead" => (
            &[
                ("hit the nail in the head", "hit the nail on the head"),
                ("hits the nail in the head", "hits the nail on the head"),
                ("hitting the nail in the head", "hitting the nail on the head"),
                ("hitted the nail in the head", "hitted the nail on the head")
            ],
            "The correct preposition in this idiom is `on`.",
            "Corrects the eggcorn `hit the nail in the head` to the standard `hit the nail on the head`.",
            LintKind::Eggcorn
        ),
        "HomeInOn" => (
            &[
                ("hone in on", "home in on"),
                ("honed in on", "homed in on"),
                ("hones in on", "homes in on"),
                ("honing in on", "homing in on"),
            ],
            "Use `home in on` rather than `hone in on`",
            "Corrects `hone in on` to `home in on`.",
            LintKind::Eggcorn
        ),
        "InDetail" => (
            &[
                ("in details", "in detail"),
                ("in more details", "in more detail"),
            ],
            "Use singular `in detail` for referring to a detailed description.",
            "Corrects unidiomatic plural `in details` to `in detail`.",
            LintKind::Usage
        ),
        "InThisThatRegard" => (
            &[
                ("in this regards", "in this regard"),
                ("in that regards", "in that regard"),
            ],
            "Use `in this/that regard` with singular `regard`.",
            "Corrects `in this/that regards` to `in this/that regard`.",
            LintKind::Usage
        ),
        "InflectionPoint" => (
            &[
                ("infliction point", "inflection point"),
                ("infliction points", "inflection points"),
            ],
            "To refer to a significant change in a trend, `inflection point` is the correct term.",
            "Corrects `infliction point` to `inflection point`.",
            LintKind::Malapropism
        ),
        "InvestIn" => (
            &[
                // Verb
                ("invest into", "invest in"),
                ("invested into", "invested in"),
                ("investing into", "investing in"),
                ("invests into", "invests in"),
                // Noun
                ("investment into", "investment in"),
                // Note "investments into" can be correct in some contexts
            ],
            "Traditionally `invest` uses the preposition `in`.",
            "`Invest` is traditionally followed by 'in,' not `into.`",
            LintKind::Usage
        ),
        "LayoutVerb" => (
            &[
                ("layouted", "laid out"),
                ("layouting", "laying out"),
                // Note "layout" and "layouts" are valid as nouns
            ],
            "`layouted` and `layouting` are non-standard verb forms. Use `laid out` and `laying out` instead.",
            "Flags nonstandard verb forms of `layout` (like `layouted` and `layouting`) and suggests the standard English verb forms (`laid out` and `laying out`).",
            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
        ),

        "LookForwardTo" => (
            &[
                ("look forward for", "look forward to"),
                ("looked forward for", "looked forward to"),
                ("looks forward for", "looks forward to"),
                ("looking forward for", "looking forward to")
            ],
            "The correct preposition in this phrase is `to`.",
            "Corrects `look forward for` to `look forward to`.",
            LintKind::Usage
        ),
        "MakeDoWith" => (
            &[
                ("make due with", "make do with"),
                ("made due with", "made do with"),
                ("makes due with", "makes do with"),
                ("making due with", "making do with"),
            ],
            "Use `do` instead of `due` when referring to a resource scarcity.",
            "Corrects `make due` to `make do` when followed by `with`."
        ),
        "MakeSense" => (
            &[
                ("make senses", "make sense"),
                ("made senses", "made sense"),
                ("makes senses", "makes sense"),
                ("making senses", "making sense")
            ],
            "Use `sense` instead of `senses`.",
            "Corrects `make senses` to `make sense`.",
            LintKind::Usage
        ),
        "MootPoint" => (
            &[
                ("mute point", "moot point"),
                ("point is mute", "point is moot"),
            ],
            "Use `moot` instead of `mute` when referring to a debatable or irrelevant point.",
            "Corrects `mute` to `moot` in the phrase `moot point`.",
            LintKind::Eggcorn
        ),
        "OperatingSystem" => (
            &[
                ("operative system", "operating system"),
                ("operative systems", "operating systems"),
            ],
            "Did you mean `operating system`?",
            "Ensures `operating system` is used correctly instead of `operative system`.",
            LintKind::Usage
        ),
        "PassersBy" => (
            &[
                ("passerbys", "passersby"),
                ("passer-bys", "passers-by"),
            ],
            "The correct plural is `passersby` or `passers-by`.",
            "Corrects `passerbys` and `passer-bys` to `passersby` or `passers-by`.",
            LintKind::Grammar
        ),
        "PeekBehindTheCurtain" => (
            &[
                ("peak behind the curtain", "peek behind the curtain"),
                ("peaked behind the curtain", "peeked behind the curtain"),
                ("peaking behind the curtain", "peeking behind the curtain"),
                ("peaks behind the curtain", "peeks behind the curtain"),
            ],
            "The correct idiom is `peek behind the curtain`.",
            "Corrects `peak behind the curtain` to `peek behind the curtain`.",
            LintKind::Eggcorn
        ),
        "Piggyback" => (
            &[
                ("piggy bag", "piggyback"),
                ("piggy bagged", "piggybacked"),
                ("piggy bagging", "piggybacking"),
            ],
            "Did you mean `piggyback`?",
            "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
        ),
        // Redundant degree modifiers on positives (double positives) → base form
        "RedundantSuperlatives" => (
            &[
                ("more optimal", "optimal"),
                ("most optimal", "optimal"),
                ("more ideal", "ideal"),
                ("most ideal", "ideal"),
            ],
            "Avoid redundant degree modifiers; prefer the base adjective.",
            "Simplifies redundant double positives like `most optimal` to the base form.",
            LintKind::Redundancy
        ),
        "ResponsibilityFor" => (
            &[
                ("take responsibility of", "take responsibility for"),
                ("took responsibility of", "took responsibility for"),
                ("taken responsibility of", "taken responsibility for"),
                ("taking responsibility of", "taking responsibility for"),
                ("takes responsibility of", "takes responsibility for"),
                ("assume responsibility of", "assume responsibility for"),
                ("assumed responsibility of", "assumed responsibility for"),
                ("assuming responsibility of", "assuming responsibility for"),
                ("assumes responsibility of", "assumes responsibility for"),
                ("claim responsibility of", "claim responsibility for"),
                ("claimed responsibility of", "claimed responsibility for"),
                ("claiming responsibility of", "claiming responsibility for"),
                ("claims responsibility of", "claims responsibility for"),
            ],
            "The correct preposition is `for`, not `of`.",
            "Corrects `take/assume/claim responsibility of` to `take/assume/claim responsibility for`.",
            LintKind::Usage
        ),
        "ScapeGoat" => (
            &[
                ("an escape goat", "a scapegoat"),
                ("escape goat", "scapegoat"),
                ("escape goats", "scapegoats"),
            ],
            "If you're referring someone is being blamed unfairly, write it as a single word: `scapegoat`.",
            "Corrects `scape goat` to `scapegoat`, which is the proper term for a person blamed for others' failures.",
            LintKind::Eggcorn
        ),
        "SeamToSeem" => (
            &[
                ("seam to be", "seem to be"),
                ("seams to be", "seems to be"),
                ("i seam", "i seem"),
                ("we seam", "we seem"),
                ("we all seam", "we all seem"),
                ("we both seam", "we both seem"),
                ("you seam", "you seem"),
                ("you all seam", "you all seem"),
                ("you both seam", "you both seem"),
                ("he seams", "he seems"),
                ("she seams", "she seems"),
                ("it seams", "it seems"),
                ("they seam", "they seem"),
                ("they all seam", "they all seem"),
                ("they both seam", "they both seem"),
                ("everything seams", "everything seems"),
                ("everybody seams", "everybody seems"),
                ("everyone seams", "everyone seems")
            ],
            "Did you mean `seem`? `Seam` refers to a line where two pieces of material are sewn together.",
            "Corrects `seam` to `seem` when used as a verb meaning `to appear` or `to give the impression`.",
            LintKind::Spelling
        ),
        "SubjunctiveWasToWere" => (
            &[
                ("if only there was", "if only there were"),
                ("if only i was", "if only i were"),
                ("if only he was", "if only he were"),
                ("if only she was", "if only she were"),
                ("if only it was", "if only it were"),
                ("i wish there was", "i wish there were"),
                ("i wish i was", "i wish i were"),
                ("i wish he was", "i wish he were"),
                ("i wish she was", "i wish she were"),
                ("i wish it was", "i wish it were")
            ],
            "Use the subjunctive mood with `if only` or `I wish`. The correct form is `were`, not `was`.",
            "Ensures proper use of the subjunctive mood in counterfactual conditional statements starting with `if only` or `I wish`.",
            LintKind::Grammar
        ),
        "UseToUsedTo" => (
            &[
                // "be" verbs + "use to" -> "used to" (accustomed to)
                ("am use to", "am used to"),
                ("are use to", "are used to"),
                ("is use to", "is used to"),
                ("was use to", "was used to"),
                ("were use to", "were used to"),
                ("be use to", "be used to"),
                // contractions of "be"
                ("i'm use to", "i'm used to"),
                ("we're use to", "we're used to"),
                ("you're use to", "you're used to"),
                ("they're use to", "they're used to"),
                ("he's use to", "he's used to"),
                ("she's use to", "she's used to"),
                ("it's use to", "it's used to"),
                // "get" forms + "use to" -> "used to" (becoming accustomed)
                ("getting use to", "getting used to"),
                ("get use to", "get used to"),
                ("got use to", "got used to"),
            ],
            "The correct form is `used to`, not `use to`.",
            "Corrects `use to` to `used to` when meaning accustomed to (after forms of `be` or `get`).",
            LintKind::Grammar
        ),
        "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
        ),
        "VerseAsVerb" => (
            &[
                ("verse against", "play against"),
                ("versed against", "played against"),
                ("versing against", "playing against"),
                ("verses against", "plays against"),
                ("verse me", "play me"),
                ("verse him", "play him"),
                ("verse her", "play her"),
                ("verse them", "play them"),
                ("verse you", "play you"),
            ],
            "`Verse` is not a verb meaning to compete. Use `play against` or `compete against` instead.",
            "Corrects the nonstandard use of `verse` as a verb (from `versus`) to standard alternatives.",
            LintKind::Nonstandard
        ),
        "WroteToRote" => (
            &[
                ("by wrote", "by rote"),
                ("by-wrote", "by-rote"),
                ("wrote learning", "rote learning"),
                ("wrote memorisation", "rote memorisation"),
                ("wrote-memorisation", "rote-memorisation"),
                ("wrote memorization", "rote memorization"),
                ("wrote-memorization", "rote-memorization"),
                ("wrote memorizing", "rote memorizing"),
            ],
            "Did you mean `rote` (mechanical memorization) instead of `wrote`?",
            "Corrects `by wrote` to `by rote`.",
            LintKind::Eggcorn
        )
    });

    add_many_to_many_mappings!(group, {
        "AwaitFor" => (
            &[
                (&["await for"], &["await", "wait for"]),
                (&["awaited for"], &["awaited", "waited for"]),
                (&["awaiting for"], &["awaiting", "waiting for"]),
                (&["awaits for"], &["awaits", "waits for"])
            ],
            "`Await` and `for` are redundant when used together - use one or the other",
            "Suggests using either `await` or `wait for` but not both, as they express the same meaning.",
            LintKind::Redundancy
        ),
        "BackhandedCompliment" => (
            &[
                (&["backhand compliment", "back-hand compliment", "back hand compliment"], &["backhanded compliment"]),
                (&["backhand compliments", "back-hand compliments", "back hand compliments"], &["backhanded compliments"]),
            ],
            "The correct spelling is `backhanded`.",
            "Corrects `backhand compliment` to `backhanded compliment`.",
            LintKind::Spelling
        ),
        "CommitmentTo" => (
            &[
                (&["commitment toward", "commitment towards"], &["commitment to"]),
                (&["commitments toward", "commitments towards"], &["commitments to"]),
            ],
            "The correct preposition to use with `commitment` is `to`, not `toward` or `towards`.",
            "Corrects `commitment toward/towards` to `commitment to`.",
            LintKind::Usage
        ),
        "Copyright" => (
            &[
                (&["copywrite"], &["copyright"]),
                (&["copywrites"], &["copyrights"]),
                (&["copywriting"], &["copyrighting"]),
                (&["copywritten", "copywrited", "copywrote"], &["copyrighted"]),
            ],
            "Did you mean `copyright`? `Copywrite` means to write copy (advertising text), while `copyright` is the legal right to control use of creative works.",
            "Corrects `copywrite` to `copyright`. `Copywrite` refers to writing copy, while `copyright` is the legal right to creative works.",
            LintKind::WordChoice
        ),
        "DateBackFrom" => (
            &[
                (&["date back from"], &["date from", "date back to"]),
                (&["dates back from"], &["dates from", "dates back to"]),
            ],
            "Use `date from` or `date back to`, not `date back from`.",
            "Corrects the blend of `date from` and `date back to` into the nonstandard `date back from`.",
            LintKind::Usage
        ),
        "DoubleEdgedSword" => (
            &[
                (&["double edge sword", "double-edge sword", "double edge-sword", "double-edge-sword",
                   "double edged sword", "double edged-sword", "double-edged-sword"], &["double-edged sword"]),
                (&["double edge swords", "double-edge swords", "double edge-swords", "double-edge-swords",
                   "double edged swords", "double edged-swords", "double-edged-swords"], &["double-edged swords"]),
            ],
            "Did you mean `double-edged sword`?",
            "Corrects variants of `double-edged sword`.",
            LintKind::Spelling
        ),
        "ExpandAlloc" => (
            &[
                (&["alloc"], &["allocate", "allocation"]),
                (&["allocs"], &["allocates", "allocations"]),
            ],
            "Use `allocate` or `allocation` instead of `alloc`",
            "Expands the abbreviation `alloc` to the full word `allocate` or `allocation` for clarity.",
            LintKind::Style
        ),
        "ExpandCoordinate" => (
            &[
                (&["coord"], &["coordinate"]),
                (&["coords"], &["coordinates"]),
            ],
            "Use `coordinate` instead of `coord`",
            "Expands the abbreviation `coord` to the full word `coordinate` for clarity.",
            LintKind::Style
        ),
        "ExpandDecl" => (
            &[
                (&["decl"], &["declaration", "declarator"]),
                (&["decls"], &["declarations", "declarators"])
            ],
            "Use `declaration` or `declarator` instead of `decl`",
            "Expands the abbreviation `decl` to the full word `declaration` or `declarator` for clarity.",
            LintKind::Style
        ),
        "ExpandGovt" => (
            &[
                (&["govt", "govt."], &["government"]),
                (&["govts"], &["governments"])
            ],
            "Use `government` instead of `govt` or `govt.`",
            "Expands the abbreviation `govt` or `govt.` to the full word `government` for clarity.",
            LintKind::Style
        ),
        "Expat" => (
            &[
                (&["ex-pat", "ex pat"], &["expat"]),
                (&["ex-pats", "ex pats"], &["expats"]),
                (&["ex-pat's", "ex pat's"], &["expat's"]),
            ],
            "The correct spelling is `expat` with no hyphen or space.",
            "Corrects the mistake of writing `expat` as two words.",
            LintKind::Spelling
        ),
        "Expatriate" => (
            &[
                (&["ex-patriot", "expatriot", "ex patriot"], &["expatriate"]),
                (&["ex-patriots", "expatriots", "ex patriots"], &["expatriates"]),
                (&["ex-patriot's", "expatriot's", "ex patriot's"], &["expatriate's"]),
            ],
            "Use the correct term for someone living abroad.",
            "Fixes the misinterpretation of `expatriate`, ensuring the correct term is used for individuals residing abroad.",
            LintKind::Eggcorn
        ),
        "GetRidOf" => (
            &[
                (&["get rid off", "get ride of", "get ride off"], &["get rid of"]),
                (&["gets rid off", "gets ride of", "gets ride off"], &["gets rid of"]),
                (&["getting rid off", "getting ride of", "getting ride off"], &["getting rid of"]),
                (&["got rid off", "got ride of", "got ride off"], &["got rid of"]),
                (&["gotten rid off", "gotten ride of", "gotten ride off"], &["gotten rid of"]),
            ],
            "The idiom is `to get rid of`, not `off` or `ride`.",
            "Corrects common misspellings of the idiom `get rid of`.",
            LintKind::Typo
        ),
        "HolyWar" => (
            &[
                (&["holey war", "holly war"], &["holy war"]),
                (&["holey wars", "holly wars"], &["holy wars"]),
            ],
            "Literally for religious conflicts and metaphorically for tech preference debats, the correct spelling is `holy war`.",
            "Corrects misspellings of `holy war`.",
            LintKind::Malapropism
        ),
        "HowItLooksLike" => (
            &[
                (&["how he looks like"], &["how he looks", "what he looks like"]),
                (&["how it looks like", "how it look like", "how it look's like"], &["how it looks", "what it looks like"]),
                (&["how she looks like"], &["how she looks", "what she looks like"]),
                (&["how they look like", "how they looks like"], &["how they look", "what they look like"]),
            ],
            "Don't use both `how` and `like` together to express similarity.",
            "Corrects `how ... looks like` to `how ... looks` or `what ... looks like`.",
            LintKind::Grammar
        ),
        "InRetaliationTo" => (
            &[
                (&["in retaliation to"], &["in retaliation for", "in response to"]),
            ],
            "Did you mean `in retaliation for` or `in response to`?",
            "Corrects `in retaliation to` to `in retaliation for` or `in response to`.",
            LintKind::Usage
        ),
        "LevelOfDetails" => (
            &[
                (&["level of details"], &["level of detail", "levels of detail"]),
                (&["level-of-details"], &["level-of-detail", "levels-of-details"]),
                (&["levels of details"], &["levels of detail"])
            ],
            "For multiple levels, pluralize `level` instead of `detail`. `Detail` remains singular whether one or multiple levels.",
            "Corrects `level of details` to `level of detail` or `levels of detail`.",
            LintKind::Usage
        ),
        "Lookalike" => (
            &[
                (&["look-a-like"], &["lookalike", "look-alike"]),
                (&["look-a-likes"], &["lookalikes", "look-alikes"])
            ],
            "Use `look alike` or `look-alike` instead of `look-a-like`.",
            "Corrects `look-a-like` to `look alike` or `look-alike`.",
            LintKind::Spelling
        ),
        "MakeItSeem" => (
            &[
                (&["make it seems"], &["make it seem"]),
                (&["made it seems", "made it seemed"], &["made it seem"]),
                (&["makes it seems"], &["makes it seem"]),
                (&["making it seems"], &["making it seem"]),
            ],
            "Don't inflect `seem` in `make it seem`.",
            "Corrects `make it seems` to `make it seem`."
        ),
        "Monumentous" => (
            &[
                (&["monumentous"], &["momentous", "monumental"]),
                (&["monumentously"], &["momentously", "monumentally"]),
            ],
            "Retain `monumentous` for jocular effect. Otherwise `momentous` indicates great signifcance while `monumental` indicates imposing size.",
            "Advises using `momentous` or `monumental` instead of `monumentous` for serious usage.",
            LintKind::Nonstandard
        ),
        "NervousWreck" => (
            &[
                (&["nerve wreck", "nerve-wreck"], &["nervous wreck"]),
                (&["nerve wrecks", "nerve-wrecks"], &["nervous wrecks"]),
            ],
            "Use `nervous wreck` when referring to a person who is extremely anxious or upset. `Nerve wreck` is non-standard but sometimes used for events or situations.",
            "Suggests using `nervous wreck` when referring to a person's emotional state.",
            LintKind::Eggcorn
        ),
        "NotOnly" => (
            &[
                (&["no only are"], &["not only are"]),
                (&["no only is"], &["not only is"]),
                (&["no only was"], &["not only was"]),
                (&["no only were"], &["not only were"]),
            ],
            "Use `not only` instead of `no only` in this expression.",
            "Corrects `no only` to `not only` before forms of `to be`.",
            LintKind::Grammar
        ),
        "Nowadays" => (
            &[(
                &[
                    "now a days", "now-a-days", "now a day's",
                    "nowaday", "now a day", "now-a-day",
                    "now adays", "now-adays", "now aday's",
                    "now aday",
                    "nowa days",
                ],
                &["nowadays"]
            )],
            "Use `nowadays` instead of common misspellings.",
            "Corrects common misspellings of `nowadays`.",
            LintKind::Usage
        ),
        "Payed" => (
            &[
                (&["payed"], &["paid"]),
                (&["overpayed"], &["overpaid"]),
            ],
            "Use `paid` or `overpaid` here. `Payed` is a rare nautical spelling.",
            "Corrects `payed` to `paid` and `overpayed` to `overpaid`.",
            LintKind::Spelling
        ),
        "RiseTheQuestion" => (
            &[
                (&["rise the question", "arise the question"], &["raise the question"]),
                (&["rises the question", "arises the question"], &["raises the question"]),
                (
                    &[
                        "risen the question", "rose the question", "rised the question",
                        "arisen the question", "arose the question", "arised the question"
                    ],
                    &["raised the question"]
                ),
                (&["rising the question", "arising the question"], &["raising the question"])
            ],
            "Use `raise` instead of `rise` when referring to the act of asking a question.",
            "Corrects `rise the question` to `raise the question`.",
            LintKind::Grammar
        ),
        "SideTangent" => (
            &[
                (&["a side tangent"], &["a tangent", "an aside"]),
                (&["side tangent"], &["tangent", "aside"]),
                (&["side tangents"], &["tangents", "aside"])
            ],
            "The word `side` is redundant in this phrase.",
            "Corrects redundant `side tangent` and `side tangents` to more concise alternatives.",
            LintKind::Redundancy
        ),
        "ToTooIdioms" => (
            &[
                (&["a bridge to far"], &["a bridge too far"]),
                (&["cake and eat it to"], &["cake and eat it too"]),
                // "a few to many" has many false positives

                (&["go to far"], &["go too far"]),
                (&["goes to far"], &["goes too far"]),
                (&["going to far"], &["going too far"]),
                (&["gone to far"], &["gone too far"]),
                (&["went to far"], &["went too far"]),

                // "in to deep" has many false positives
                (&["life's to short", "lifes to short"], &["life's too short"]),
                (&["life is to short"], &["life is too short"]),

                // "one to many" has many false positives
                (&["put to fine a point"], &["put too fine a point"], ),

                (&["speak to soon"], &["speak too soon"]),
                (&["speaking to soon"], &["speaking too soon"]),
                // "speaks to soon" is very rare
                (&["spoke to soon"], &["spoke too soon"]),
                (&["spoken to soon"], &["spoken too soon"]),

                (&["think to much"], &["think too much"]),
                (&["to big for"], &["too big for"]),
                (&["to big to fail"], &["too big to fail"]),
                (&["to good to be true", "too good too be true"], &["too good to be true"]),
                (&["to much information"], &["too much information"]),
            ],
            "Use `too` rather than `to` in this expression.",
            "Corrects `to` used instead of `too`.",
            LintKind::Grammar
        ),
        "TooTo" => (
            &[
                (&["too big too fail"], &["too big to fail"])
            ],
            "Use `to` rather than `too` in this expression.",
            "Corrects `too` used instead of `to`.",
            LintKind::Grammar
        ),
        "WholeEntire" => (
            &[
                (&["whole entire"], &["whole", "entire"]),
                // Avoid suggestions resulting in "a entire ...."
                (&["a whole entire"], &["a whole", "an entire"]),
            ],
            "Avoid redundancy. Use either `whole` or `entire` for referring to the complete amount or extent.",
            "Corrects the redundancy in `whole entire` to `whole` or `entire`.",
            LintKind::Redundancy
        ),
        "WorseOrWorst" => (
            &[
                // worst -> worse
                (&["a lot worst", "alot worst"], &["a lot worse"]),
                (&["become worst"], &["become worse"]),
                (&["became worst"], &["became worse"]),
                (&["becomes worst"], &["becomes worse"]),
                (&["becoming worst"], &["becoming worse"]),
                (&["far worst"], &["far worse"]),
                (&["get worst"], &["get worse"]),
                (&["gets worst"], &["gets worse"]),
                (&["getting worst"], &["getting worse"]),
                (&["got worst"], &["got worse"]),
                (&["gotten worst"], &["gotten worse"]),
                (&["make it worst"], &["make it worse"]),
                (&["made it worst"], &["made it worse"]),
                (&["makes it worst"], &["makes it worse"]),
                (&["making it worst"], &["making it worse"]),
                (&["make them worst"], &["make them worse"]),
                (&["made them worst"], &["made them worse"]),
                (&["makes them worst"], &["makes them worse"]),
                (&["making them worst"], &["making them worse"]),
                (&["much worst"], &["much worse"]),
                (&["turn for the worst"], &["turn for the worse"]),
                (&["worst and worst", "worse and worst", "worst and worse"], &["worse and worse"]),
                (&["worst than"], &["worse than"]),
                // worse -> worst
                (&["at worse"], &["at worst"]),
                (&["worse case scenario", "worse-case scenario", "worse-case-scenario"], &["worst-case scenario"]),
                (&["worse ever"], &["worst ever"]),
            ],
            "`Worse` is for comparing and `worst` is for the extreme case.",
            "Corrects `worse` and `worst` used in contexts where the other belongs.",
            LintKind::Agreement
        ),
    });

    group.set_all_rules_to(Some(true));

    group
}
