harper-core 2.0.0

The language checker for developers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
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
        ),
        "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
        ),
        "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
        ),
        "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
        ),
        "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
        ),
        "ExpandDeref" => (
            &[
                ("deref", "dereference"),
                ("derefs", "dereferences"),
            ],
            "Use `dereference` instead of `deref`",
            "Expands the abbreviation `deref` to the full word `dereference` 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
        ),
        "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
        ),
        "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
        ),
        "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
        ),
        "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
        ),
        "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
        ),
        "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`."
        ),
        "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
        ),
        "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
        ),
        "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
}