* [bug#48750] [PATCH 1/2] lint: Check for trailing whitespace in synopsis.
[not found] <id:cover.1622406254.git.public@yoctocell.xyz>
@ 2021-05-30 20:30 ` Xinglu Chen
2021-05-30 20:30 ` [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description Xinglu Chen
1 sibling, 0 replies; 3+ messages in thread
From: Xinglu Chen @ 2021-05-30 20:30 UTC (permalink / raw)
To: 48750; +Cc: Xinglu Chen
* 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description.
[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
@ 2021-05-30 20:30 ` Xinglu Chen
1 sibling, 0 replies; 3+ messages in thread
From: Xinglu Chen @ 2021-05-30 20:30 UTC (permalink / raw)
To: 48750; +Cc: Xinglu Chen
* 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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [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 2/2] lint: Check for trailing whitespace in description Xinglu Chen
0 siblings, 1 reply; 3+ 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] 3+ 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 ` Xinglu Chen
0 siblings, 0 replies; 3+ 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 related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-30 20:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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
2021-05-30 20:30 ` [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description Xinglu Chen
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 2/2] lint: Check for trailing whitespace in description Xinglu Chen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.