GNU bug report logs - #44675
guix lint: support for spellchecker or basic grammar

Previous Next

Package: guix;

Reported by: Vagrant Cascadian <vagrant <at> debian.org>

Date: Mon, 16 Nov 2020 01:55:01 UTC

Severity: normal

Tags: easy

Done: Vagrant Cascadian <vagrant <at> debian.org>

Bug is archived. No further changes may be made.

Full log


Message #37 received at 44675 <at> debbugs.gnu.org (full text, mbox):

From: Vagrant Cascadian <vagrant <at> debian.org>
To: 44675 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>,
 Maxime Devos <maximedevos <at> telenet.be>, Efraim Flashner <efraim <at> flashner.co.il>
Subject: Re: bug#44675: guix lint: support for spellchecker or basic grammar
Date: Thu, 21 Oct 2021 16:18:34 -0700
[Message part 1 (text/plain, inline)]
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
[0001-lint-Add-description-check-for-pluralized-This-packa.patch (text/x-diff, inline)]
From 3ab46ca7932614ab4c699512c2fbfa8207ffa964 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant <at> 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 (application/pgp-signature, inline)]

This bug report was last modified 3 years and 292 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.