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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 48750 in the body.
You can then email your comments to 48750 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#48750; Package guix-patches. (Sun, 30 May 2021 19:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 30 May 2021 19:41:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/2] Check for trailing whitespace in synopsis and description.
Date: Sun, 30 May 2021 21:40:09 +0200
This patch series adds to checkers that check for trailing whitespace in
synopses and descriptions.

There is ‘report-trailing-white-space’, but it only checks for trailing
whitespace in the file itself, not in the string for the
synopsis/description.

Xinglu Chen (2):
  lint: Check for trailing whitespace in synopsis.
  lint: Check for trailing whitespace in description.

 guix/lint.scm  | 22 +++++++++++++++++++++-
 tests/lint.scm | 14 ++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)


base-commit: cefa260fb42693b87545b1baab8cef9723827f80
-- 
2.31.1






Information forwarded to guix-patches <at> gnu.org:
bug#48750; Package guix-patches. (Sun, 30 May 2021 19:43:01 GMT) Full text and rfc822 format available.

Message #8 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 1/2] lint: Check for trailing whitespace in synopsis.
Date: Sun, 30 May 2021 21:42:37 +0200
* guix/lint.scm (check-synopsis-style): Check for trailing whitespace.
* tests/lint.scm ("synopsis: contains trailing whitespace"): New test.
---
 guix/lint.scm  | 12 +++++++++++-
 tests/lint.scm |  7 +++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/guix/lint.scm b/guix/lint.scm
index a2d6418b85..d2ef4f34b2 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -456,13 +456,23 @@ markup is valid return a plain-text version of SYNOPSIS, otherwise #f."
                        (G_ "Texinfo markup in synopsis is invalid")
                        #:field 'synopsis)))))
 
+  (define (check-no-trailing-whitespace synopsis)
+    "Check that SYNOPSIS doesn't have trailing whitespace."
+    (if (string-suffix? " " synopsis)
+        (list
+         (make-warning package
+                       (G_ "synopsis contains trailing whitespace")
+                       #:field 'synopsis))
+        '()))
+
   (define checks
     (list check-proper-start
           check-final-period
           check-start-article
           check-start-with-package-name
           check-synopsis-length
-          check-texinfo-markup))
+          check-texinfo-markup
+          check-no-trailing-whitespace))
 
   (match (package-synopsis package)
     (""
diff --git a/tests/lint.scm b/tests/lint.scm
index d54fafc1d2..dddbf0679f 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -271,6 +271,13 @@
                             (description "Imagine this is Taylor UUCP."))))
     (check-synopsis-style pkg)))
 
+(test-equal "synopsis: contains trailing whitespace"
+  "synopsis contains trailing whitespace"
+  (single-lint-warning-message
+   (let ((pkg (dummy-package "x"
+                             (synopsis "Whitespace "))))
+     (check-synopsis-style pkg))))
+
 (test-equal "name: use underscore in package name"
   "name should use hyphens instead of underscores"
   (single-lint-warning-message
-- 
2.31.1






Information forwarded to guix-patches <at> gnu.org:
bug#48750; Package guix-patches. (Sun, 30 May 2021 19:44:02 GMT) Full text and rfc822 format available.

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






Information forwarded to guix-patches <at> gnu.org:
bug#48750; Package guix-patches. (Sun, 30 May 2021 20:26:02 GMT) Full text and rfc822 format available.

Message #14 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 v2 0/2] Check for trailing whitespace in synopsis and
 description.
Date: Sun, 30 May 2021 22:25:18 +0200
Sorry, I had some unstaged changes which I forgot to commit.

Xinglu Chen (2):
  lint: Check for trailing whitespace in synopsis.
  lint: Check for trailing whitespace in description.

 guix/lint.scm  | 22 +++++++++++++++++++++-
 tests/lint.scm | 14 ++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)


base-commit: cefa260fb42693b87545b1baab8cef9723827f80
-- 
2.31.1






Information forwarded to guix-patches <at> gnu.org:
bug#48750; Package guix-patches. (Sun, 30 May 2021 20:32:01 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: 48750 <at> debbugs.gnu.org
Cc: Xinglu Chen <public <at> yoctocell.xyz>
Subject: [PATCH 1/2] lint: Check for trailing whitespace in synopsis.
Date: Sun, 30 May 2021 22:30:31 +0200
* guix/lint.scm (check-synopsis-style): Check for trailing whitespace.
* tests/lint.scm ("synopsis: contains trailing whitespace"): New test.
---
 guix/lint.scm  | 12 +++++++++++-
 tests/lint.scm |  7 +++++++
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/guix/lint.scm b/guix/lint.scm
index a2d6418b85..d2ef4f34b2 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -456,13 +456,23 @@ markup is valid return a plain-text version of SYNOPSIS, otherwise #f."
                        (G_ "Texinfo markup in synopsis is invalid")
                        #:field 'synopsis)))))
 
+  (define (check-no-trailing-whitespace synopsis)
+    "Check that SYNOPSIS doesn't have trailing whitespace."
+    (if (string-suffix? " " synopsis)
+        (list
+         (make-warning package
+                       (G_ "synopsis contains trailing whitespace")
+                       #:field 'synopsis))
+        '()))
+
   (define checks
     (list check-proper-start
           check-final-period
           check-start-article
           check-start-with-package-name
           check-synopsis-length
-          check-texinfo-markup))
+          check-texinfo-markup
+          check-no-trailing-whitespace))
 
   (match (package-synopsis package)
     (""
diff --git a/tests/lint.scm b/tests/lint.scm
index d54fafc1d2..dddbf0679f 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -271,6 +271,13 @@
                             (description "Imagine this is Taylor UUCP."))))
     (check-synopsis-style pkg)))
 
+(test-equal "synopsis: contains trailing whitespace"
+  "synopsis contains trailing whitespace"
+  (single-lint-warning-message
+   (let ((pkg (dummy-package "x"
+                             (synopsis "Whitespace "))))
+     (check-synopsis-style pkg))))
+
 (test-equal "name: use underscore in package name"
   "name should use hyphens instead of underscores"
   (single-lint-warning-message

base-commit: cefa260fb42693b87545b1baab8cef9723827f80
-- 
2.31.1





Information forwarded to guix-patches <at> gnu.org:
bug#48750; Package guix-patches. (Sun, 30 May 2021 20:32:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: 48750 <at> debbugs.gnu.org
Cc: Xinglu Chen <public <at> yoctocell.xyz>
Subject: [PATCH 2/2] lint: Check for trailing whitespace in description.
Date: Sun, 30 May 2021 22:30:32 +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..f4b601cf4f 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 description)
          (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..25615085df 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 ((pkg (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





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 08 Jun 2021 21:07:01 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Tue, 08 Jun 2021 21:07:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 48750-done <at> debbugs.gnu.org
Subject: Re: bug#48750: [PATCH 0/2] Check for trailing whitespace in
 synopsis and description.
Date: Tue, 08 Jun 2021 23:06:45 +0200
Hi,

Xinglu Chen <public <at> yoctocell.xyz> skribis:

>   lint: Check for trailing whitespace in synopsis.
>   lint: Check for trailing whitespace in description.

Applied, thanks!

‘guix lint -c description’ shows there’s a surprisingly large number of
synopses/descriptions with trailing white space, so it’s going to be
useful.

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 07 Jul 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 265 days ago.

Previous Next


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