On 2021-06-09, Vagrant Cascadian wrote: > There have been at least three newly added "This packages" since I > submitted this patch, so wondering if we can at least get the simple > case merged before getting too caught up in all the potential > improvements?
And up until today, that list grew to 7! (fixed by Long delayed updated patch ... I think it addresses almost all of the issues brought up, and maybe introduces a few new ones! 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... Big thanks to rekado, vivien and nckx who helped via #guix IRC! live well, vagrant
From 3ab46ca7932614ab4c699512c2fbfa8207ffa964 Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian <vagr...@debian.org> Date: Thu, 21 Oct 2021 15:51:11 -0700 Subject: [PATCH] lint: Add description check for pluralized "This package" Partial fix for: https://issues.guix.gnu.org/44675 * guix/lint.scm (check-description-typo): Add check for occurances of "This packages" in package descriptions. * tests/lint.scm: Add test. --- guix/lint.scm | 12 ++++++++++++ tests/lint.scm | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/guix/lint.scm b/guix/lint.scm index 7b02b9cec0..b22454fd31 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -321,6 +321,17 @@ 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 correction) + "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)))) + '())) + (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 +412,7 @@ 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") ;; Use raw description for this because Texinfo rendering ;; automatically fixes end of sentence space. (check-end-of-sentence-space description) diff --git a/tests/lint.scm b/tests/lint.scm index 699a750eb9..1902a87354 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -177,6 +177,13 @@ (description "Whitespace. ")))) (check-description-style pkg)))) +(test-equal "description: pluralized 'This package'" + "description contains typo 'This packages', should be 'This package'" + (single-lint-warning-message + (let ((pkg (dummy-package "x" + (description "This packages is a typo.")))) + (check-description-style pkg)))) + (test-equal "synopsis: not a string" "invalid synopsis: #f" (single-lint-warning-message -- 2.30.2
signature.asc
Description: PGP signature