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 1/2] lint: Check for trailing whitespace in synopsis.
Date: Sun, 30 May 2021 21:42:37 +0200	[thread overview]
Message-ID: <2263996fdbd5853d7c16ea5fade00f1e1c0a448d.1622403325.git.public@yoctocell.xyz> (raw)
In-Reply-To: <cover.1622403325.git.public@yoctocell.xyz>

* 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






  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 ` Xinglu Chen [this message]
2021-05-30 19:42 ` [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description Xinglu Chen
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 1/2] lint: Check for trailing whitespace in synopsis 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=2263996fdbd5853d7c16ea5fade00f1e1c0a448d.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).