mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
lint: Check for trailing whitespace in description.
* guix/lint.scm (check-description-style): Check for trailing whitespace. * tests/lint.scm: ("description: trailing whitespace"): New test. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
04afb76958
commit
93d85deae6
2 changed files with 17 additions and 0 deletions
|
@ -300,6 +300,15 @@ (define (check-end-of-sentence-space description)
|
|||
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
|
||||
|
@ -309,6 +318,7 @@ (define (check-end-of-sentence-space description)
|
|||
;; 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
|
||||
|
|
|
@ -160,6 +160,13 @@ (define (warning-contains? str warnings)
|
|||
(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
|
||||
|
|
Loading…
Reference in a new issue