On 2021-10-22, zimoun wrote: > On Thu, 21 Oct 2021 at 16:18, Vagrant Cascadian wrote: > >> It has been rewritten to easily add new typo checks, but this one so far >> only addresses pluralized "This packages". Would be easy enough to add >> "allows to" but hard to add a suggested fix... > > If I remember correctly the previous discussion, Debian uses an external > tool for spellchecking. Here, the patch uses a list of “common” > mistakes. It is seems an easy good start. :-) Yes, I definitely went for "catch some useful things" rather than trying to be comprehensive... these checks should catch the majority of historical ones I've noticed, but I didn't bother adding one-off typos. > Instead, I would use a list of alist ’typo-corrections’ as argument. > For instance, > > --8<---------------cut here---------------start------------->8--- > (define (check-description-typo description typo-corrections) > (for-each > (match-lambda > ((typo . correction) > (if (string-contains description typo) > (list > (make-warning ...)) > '()))) > typo-corrections)) > --8<---------------cut here---------------end--------------->8--- So close! Ludo spotted that the for-each needed to be replaced with append-map, and that basically did it! > (check-description-typo description '(("This packages" . "This package"))) > > which allows easily to add new pattern; such as, > > '(("This packages" . "This package") > ("this packages" . "this package") > ("This modules" . "This module")) > > Then, as a second step, depending on the patterns listed, let see if > there is a pattern inside these patterns. ;-) (Check both capitalize and > lower-case, etc.) I haven't seen case issues in practice for these. I've added "This packages", "This modules", "allows to" and "permits to" to the list while I was at it. I only added tests for "This packages" and "allows to" as the others are so similar I'm not sure it's worth testing... Here's to hoping for a guix with fewer glaring typos with which to craft guix poetry. :) New patch attached! live well, vagrant