summaryrefslogtreecommitdiff
path: root/guix/lint.scm
diff options
context:
space:
mode:
authorVagrant Cascadian <vagrant@debian.org>2021-10-24 04:00:15 -0700
committerVagrant Cascadian <vagrant@debian.org>2021-10-24 14:26:12 -0700
commitb5f45a21c27b80210753e184e52708bb75a347bb (patch)
tree3e8c881ab769579adb65d5470fc2a59eb6c93496 /guix/lint.scm
parent65be27dcfd799e4d14cafc49e253d08836f73350 (diff)
lint: Add description check for common typos.
Fixes: https://issues.guix.gnu.org/44675 * guix/lint.scm (check-description-typo): Add check for occurences of "This packages", "This modules", "allows to" and "permits to" in package descriptions. * tests/lint.scm: Add tests for "This packages" and "allows to".
Diffstat (limited to 'guix/lint.scm')
-rw-r--r--guix/lint.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 7b02b9cec0..ac2e7b3841 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -321,6 +321,21 @@ markup is valid return a plain-text version of DESCRIPTION, otherwise #f."
(G_ "Texinfo markup in description is invalid")
#:field 'description))))
+ (define (check-description-typo description typo-corrections)
+ "Check that DESCRIPTION does not contain typo, with optional correction"
+ (append-map
+ (match-lambda
+ ((typo . correction)
+ (if (string-contains description typo)
+ (list
+ (make-warning package
+ (G_
+ (format #false
+ "description contains typo '~a'~@[, should be '~a'~]"
+ typo correction))))
+ '())))
+ typo-corrections))
+
(define (check-trademarks description)
"Check that DESCRIPTION does not contain '™' or '®' characters. See
http://www.gnu.org/prep/standards/html_node/Trademarks.html."
@@ -401,6 +416,10 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
(check-not-empty description)
(check-quotes description)
(check-trademarks description)
+ (check-description-typo description '(("This packages" . "This package")
+ ("This modules" . "This module")
+ ("allows to" . #f)
+ ("permits to" . #f)))
;; Use raw description for this because Texinfo rendering
;; automatically fixes end of sentence space.
(check-end-of-sentence-space description)