lint: Check non-translated package descriptions.
* guix/ui.scm (texi->plain-text): Export. * guix/scripts/lint.scm (check-description-style): Use it instead of 'package-description-string'.
This commit is contained in:
parent
a7a4fd9a7c
commit
2748ee3bcf
|
@ -143,12 +143,14 @@ monad."
|
||||||
(_ "description should not be empty")
|
(_ "description should not be empty")
|
||||||
'description)))
|
'description)))
|
||||||
|
|
||||||
(define (check-texinfo-markup package)
|
(define (check-texinfo-markup description)
|
||||||
"Check that PACKAGE description can be parsed as a Texinfo fragment."
|
"Check that DESCRIPTION can be parsed as a Texinfo fragment. If the
|
||||||
|
markup is valid return a plain-text version of DESCRIPTION, otherwise #f."
|
||||||
(catch 'parser-error
|
(catch 'parser-error
|
||||||
(lambda () (package-description-string package))
|
(lambda () (texi->plain-text description))
|
||||||
(lambda (keys . args)
|
(lambda (keys . args)
|
||||||
(emit-warning package (_ "Texinfo markup in description is invalid")))))
|
(emit-warning package (_ "Texinfo markup in description is invalid"))
|
||||||
|
#f)))
|
||||||
|
|
||||||
(define (check-proper-start description)
|
(define (check-proper-start description)
|
||||||
(unless (or (properly-starts-sentence? description)
|
(unless (or (properly-starts-sentence? description)
|
||||||
|
@ -179,9 +181,11 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
|
||||||
(let ((description (package-description package)))
|
(let ((description (package-description package)))
|
||||||
(when (string? description)
|
(when (string? description)
|
||||||
(check-not-empty description)
|
(check-not-empty description)
|
||||||
(check-texinfo-markup package)
|
;; Use raw description for this because Texinfo rendering automatically
|
||||||
(check-proper-start description)
|
;; fixes end of sentence space.
|
||||||
(check-end-of-sentence-space description))))
|
(check-end-of-sentence-space description)
|
||||||
|
(and=> (check-texinfo-markup description)
|
||||||
|
check-proper-start))))
|
||||||
|
|
||||||
(define (check-inputs-should-be-native package)
|
(define (check-inputs-should-be-native package)
|
||||||
;; Emit a warning if some inputs of PACKAGE are likely to belong to its
|
;; Emit a warning if some inputs of PACKAGE are likely to belong to its
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
switch-symlinks
|
switch-symlinks
|
||||||
config-directory
|
config-directory
|
||||||
fill-paragraph
|
fill-paragraph
|
||||||
|
texi->plain-text
|
||||||
package-description-string
|
package-description-string
|
||||||
string->recutils
|
string->recutils
|
||||||
package->recutils
|
package->recutils
|
||||||
|
|
Loading…
Reference in New Issue