aboutsummaryrefslogtreecommitdiff
path: root/guix/lint.scm
diff options
context:
space:
mode:
authorBrice Waegeneire <brice@waegenei.re>2021-06-19 21:59:48 +0200
committerBrice Waegeneire <brice@waegenei.re>2021-07-13 07:25:05 +0200
commitedb328ad83bf55e021018719d24f7c29adc43a96 (patch)
treef735127984e933e6648b278d963bb72aeea15265 /guix/lint.scm
parenta5fa05dfc7e5bbe0191938b7824ec264aa842306 (diff)
downloadguix-edb328ad83bf55e021018719d24f7c29adc43a96.tar
guix-edb328ad83bf55e021018719d24f7c29adc43a96.tar.gz
lint: Check for leading whitespace in description.
* guix/lint.scm (check-description-style): Check for leading whitespace. * tests/lint.scm: ("description: leading whitespace"): New test.
Diffstat (limited to 'guix/lint.scm')
-rw-r--r--guix/lint.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/guix/lint.scm b/guix/lint.scm
index 8f31de041d..ffd3f7007e 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.
;;;
@@ -376,6 +377,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)
@@ -394,6 +404,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))