guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/04: lint: Check for trailing whitespace in synopsis.


From: guix-commits
Subject: 03/04: lint: Check for trailing whitespace in synopsis.
Date: Tue, 8 Jun 2021 17:29:03 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 04afb76958184b2a6dafa2815a2a410424a05d84
Author: Xinglu Chen <public@yoctocell.xyz>
AuthorDate: Sun May 30 22:30:31 2021 +0200

    lint: Check for trailing whitespace in synopsis.
    
    * guix/lint.scm (check-synopsis-style): Check for trailing whitespace.
    * tests/lint.scm ("synopsis: contains trailing whitespace"): New test.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 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 5cd6db5..1aba9ef 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -478,13 +478,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 f4c3dde..97ed5ee 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]