unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Xinglu Chen <public@yoctocell.xyz>
To: 48750@debbugs.gnu.org
Subject: [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description.
Date: Sun, 30 May 2021 21:42:59 +0200	[thread overview]
Message-ID: <7f6526ca35091658589205efeb9f99f5e3a0c1e9.1622403325.git.public@yoctocell.xyz> (raw)
In-Reply-To: <cover.1622403325.git.public@yoctocell.xyz>

* 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






  parent reply	other threads:[~2021-05-30 19:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-30 19:40 [bug#48750] [PATCH 0/2] Check for trailing whitespace in synopsis and description Xinglu Chen
2021-05-30 19:42 ` [bug#48750] [PATCH 1/2] lint: Check for trailing whitespace in synopsis Xinglu Chen
2021-05-30 19:42 ` Xinglu Chen [this message]
2021-05-30 20:25 ` [bug#48750] [PATCH v2 0/2] Check for trailing whitespace in synopsis and description Xinglu Chen
2021-06-08 21:06   ` bug#48750: [PATCH " Ludovic Courtès
     [not found] <id:cover.1622406254.git.public@yoctocell.xyz>
2021-05-30 20:30 ` [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description Xinglu Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f6526ca35091658589205efeb9f99f5e3a0c1e9.1622403325.git.public@yoctocell.xyz \
    --to=public@yoctocell.xyz \
    --cc=48750@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).