* [bug#49133] [PATCH] lint: Check for leading whitespace in description.
@ 2021-06-20 13:34 Brice Waegeneire
2021-07-08 14:10 ` Mathieu Othacehe
0 siblings, 1 reply; 3+ messages in thread
From: Brice Waegeneire @ 2021-06-20 13:34 UTC (permalink / raw)
To: 49133
* guix/lint.scm (check-description-style): Check for leading whitespace.
* tests/lint.scm: ("description: leading whitespace"): New test.
---
guix/lint.scm | 11 +++++++++++
tests/lint.scm | 7 +++++++
2 files changed, 18 insertions(+)
diff --git a/guix/lint.scm b/guix/lint.scm
index d65d5ce8f9..d18fcf920e 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -13,6 +13,7 @@
;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -300,6 +301,15 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
infractions)
#:field 'description)))))
+ (define (check-no-leading-whitespace description)
+ "Check that DESCRIPTION doesn't have trailing whitespace."
+ (if (string-prefix? " " description)
+ (list
+ (make-warning package
+ (G_ "description contains leading whitespace")
+ #:field 'description))
+ '()))
+
(define (check-no-trailing-whitespace description)
"Check that DESCRIPTION doesn't have trailing whitespace."
(if (string-suffix? " " description)
@@ -318,6 +328,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-leading-whitespace description)
(check-no-trailing-whitespace description)
(match (check-texinfo-markup description)
((and warning (? lint-warning?)) (list warning))
diff --git a/tests/lint.scm b/tests/lint.scm
index fae346e724..dd442f6af9 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: leading whitespace"
+ "description contains leading whitespace"
+ (single-lint-warning-message
+ (let ((pkg (dummy-package "x"
+ (description " Whitespace."))))
+ (check-description-style pkg))))
+
(test-equal "description: trailing whitespace"
"description contains trailing whitespace"
(single-lint-warning-message
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [bug#49133] [PATCH] lint: Check for leading whitespace in description.
2021-06-20 13:34 [bug#49133] [PATCH] lint: Check for leading whitespace in description Brice Waegeneire
@ 2021-07-08 14:10 ` Mathieu Othacehe
2021-07-13 5:26 ` bug#49133: " Brice Waegeneire
0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Othacehe @ 2021-07-08 14:10 UTC (permalink / raw)
To: Brice Waegeneire; +Cc: 49133
Hey Brice,
> * guix/lint.scm (check-description-style): Check for leading whitespace.
> * tests/lint.scm: ("description: leading whitespace"): New test.
Looks fine, you can go ahead.
Thanks,
Mathieu
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#49133: [PATCH] lint: Check for leading whitespace in description.
2021-07-08 14:10 ` Mathieu Othacehe
@ 2021-07-13 5:26 ` Brice Waegeneire
0 siblings, 0 replies; 3+ messages in thread
From: Brice Waegeneire @ 2021-07-13 5:26 UTC (permalink / raw)
To: Mathieu Othacehe; +Cc: 49133-done
Mathieu Othacehe <othacehe@gnu.org> writes:
>> * guix/lint.scm (check-description-style): Check for leading whitespace.
>> * tests/lint.scm: ("description: leading whitespace"): New test.
>
> Looks fine, you can go ahead.
Thanks, pushed as edb328ad83bf55e021018719d24f7c29adc43a96.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-13 5:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-20 13:34 [bug#49133] [PATCH] lint: Check for leading whitespace in description Brice Waegeneire
2021-07-08 14:10 ` Mathieu Othacehe
2021-07-13 5:26 ` bug#49133: " Brice Waegeneire
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).