GNU bug report logs - #48750
[PATCH 0/2] Check for trailing whitespace in synopsis and description.

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Sun, 30 May 2021 19:41:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: 48750 <at> debbugs.gnu.org
Subject: [PATCH 2/2] lint: Check for trailing whitespace in description.
Date: Sun, 30 May 2021 21:42:59 +0200
* guix/lint.scm (check-description-style): Check for trailing whitespace.
* tests/lint.scm: ("description: trailing whitespace"): New test.
---
 guix/lint.scm  | 10 ++++++++++
 tests/lint.scm |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/guix/lint.scm b/guix/lint.scm
index d2ef4f34b2..4fdebc0aff 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -278,6 +278,15 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
                                infractions)
                          #:field 'description)))))
 
+  (define (check-no-trailing-whitespace DESCRIPTION)
+    "Check that DESCRIPTION doesn't have trailing whitespace."
+    (if (string-suffix? " " description)
+        (list
+         (make-warning package
+                       (G_ "description contains trailing whitespace")
+                       #:field 'description))
+        '()))
+
   (let ((description (package-description package)))
     (if (string? description)
         (append
@@ -287,6 +296,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
          ;; Use raw description for this because Texinfo rendering
          ;; automatically fixes end of sentence space.
          (check-end-of-sentence-space description)
+         (check-no-trailing-whitespace)
          (match (check-texinfo-markup description)
            ((and warning (? lint-warning?)) (list warning))
            (plain-description
diff --git a/tests/lint.scm b/tests/lint.scm
index dddbf0679f..5c1e9d3db2 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -160,6 +160,13 @@
                              (description "This is a 'quoted' thing."))))
      (check-description-style pkg))))
 
+(test-equal "description: trailing whitespace"
+  "description contains trailing whitespace"
+  (single-lint-warning-message
+   (let ((pkgs (dummy-package "x"
+                              (description "Whitespace. "))))
+     (check-description-style pkg))))
+
 (test-equal "synopsis: not a string"
   "invalid synopsis: #f"
   (single-lint-warning-message
-- 
2.31.1






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

Previous Next


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