[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44675: guix lint: support for spellchecker or basic grammar
From: |
zimoun |
Subject: |
bug#44675: guix lint: support for spellchecker or basic grammar |
Date: |
Fri, 22 Oct 2021 10:33:27 +0200 |
Hi Vagrant,
On Thu, 21 Oct 2021 at 16:18, Vagrant Cascadian <vagrant@debian.org> 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. :-)
> + (define (check-description-typo description typo correction)
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---
> + "Check that DESCRIPTION does not contain typo, with optional
> correction"
> + (if (string-contains description typo)
> + (list
> + (make-warning package
> + (G_
> + (format #false
> + "description contains typo '~a'~@[, should
> be '~a'~]"
> + typo correction))))
> + '()))
> +
[...]
> + (check-description-typo description "This packages" "This package")
And the call reads,
(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.)
Cheers,
simon