unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#48750] [PATCH 0/2] Check for trailing whitespace in synopsis and description.
@ 2021-05-30 19:40 Xinglu Chen
  2021-05-30 19:42 ` [bug#48750] [PATCH 1/2] lint: Check for trailing whitespace in synopsis Xinglu Chen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Xinglu Chen @ 2021-05-30 19:40 UTC (permalink / raw)
  To: 48750

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#48750] [PATCH 1/2] lint: Check for trailing whitespace in synopsis.
  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
  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
  2 siblings, 0 replies; 5+ messages in thread
From: Xinglu Chen @ 2021-05-30 19:42 UTC (permalink / raw)
  To: 48750

* 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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description.
  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
  2021-05-30 20:25 ` [bug#48750] [PATCH v2 0/2] Check for trailing whitespace in synopsis and description Xinglu Chen
  2 siblings, 0 replies; 5+ messages in thread
From: Xinglu Chen @ 2021-05-30 19:42 UTC (permalink / raw)
  To: 48750

* 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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* [bug#48750] [PATCH v2 0/2] Check for trailing whitespace in synopsis and description.
  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 ` [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description Xinglu Chen
@ 2021-05-30 20:25 ` Xinglu Chen
  2021-06-08 21:06   ` bug#48750: [PATCH " Ludovic Courtès
  2 siblings, 1 reply; 5+ messages in thread
From: Xinglu Chen @ 2021-05-30 20:25 UTC (permalink / raw)
  To: 48750

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






^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#48750: [PATCH 0/2] Check for trailing whitespace in synopsis and description.
  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   ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2021-06-08 21:06 UTC (permalink / raw)
  To: Xinglu Chen; +Cc: 48750-done

Hi,

Xinglu Chen <public@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’.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-08 21:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git