lint: Allow synopses that start with an abbreviation.
* guix/scripts/lint.scm (starts-with-abbreviation?): New procedure. (check-synopsis-style)[check-start-with-package-name]: Use it. * tests/lint.scm ("synopsis: start with abbreviation"): New test.
This commit is contained in:
parent
105c260f00
commit
15a6d433ff
@ -80,6 +80,10 @@
|
|||||||
(define (properly-starts-sentence? s)
|
(define (properly-starts-sentence? s)
|
||||||
(string-match "^[(\"'[:upper:][:digit:]]" s))
|
(string-match "^[(\"'[:upper:][:digit:]]" s))
|
||||||
|
|
||||||
|
(define (starts-with-abbreviation? s)
|
||||||
|
"Return #t if S starts with what looks like an abbreviation or acronym."
|
||||||
|
(string-match "^[A-Z][A-Z0-9]+\\>" s))
|
||||||
|
|
||||||
(define (check-description-style package)
|
(define (check-description-style package)
|
||||||
;; Emit a warning if stylistic issues are found in the description of PACKAGE.
|
;; Emit a warning if stylistic issues are found in the description of PACKAGE.
|
||||||
(define (check-not-empty description)
|
(define (check-not-empty description)
|
||||||
@ -180,7 +184,8 @@ line."
|
|||||||
'synopsis)))
|
'synopsis)))
|
||||||
|
|
||||||
(define (check-start-with-package-name synopsis)
|
(define (check-start-with-package-name synopsis)
|
||||||
(when (regexp-exec (package-name-regexp package) synopsis)
|
(when (and (regexp-exec (package-name-regexp package) synopsis)
|
||||||
|
(not (starts-with-abbreviation? synopsis)))
|
||||||
(emit-warning package
|
(emit-warning package
|
||||||
"synopsis should not start with the package name"
|
"synopsis should not start with the package name"
|
||||||
'synopsis)))
|
'synopsis)))
|
||||||
|
@ -202,6 +202,16 @@
|
|||||||
(synopsis "Arbitrary precision"))))
|
(synopsis "Arbitrary precision"))))
|
||||||
(check-synopsis-style pkg))))))
|
(check-synopsis-style pkg))))))
|
||||||
|
|
||||||
|
(test-assert "synopsis: start with abbreviation"
|
||||||
|
(string-null?
|
||||||
|
(call-with-warnings
|
||||||
|
(lambda ()
|
||||||
|
(let ((pkg (dummy-package "uucp"
|
||||||
|
;; Same problem with "APL interpreter", etc.
|
||||||
|
(synopsis "UUCP implementation")
|
||||||
|
(description "Imagine this is Taylor UUCP."))))
|
||||||
|
(check-synopsis-style pkg))))))
|
||||||
|
|
||||||
(test-assert "inputs: pkg-config is probably a native input"
|
(test-assert "inputs: pkg-config is probably a native input"
|
||||||
(->bool
|
(->bool
|
||||||
(string-contains
|
(string-contains
|
||||||
|
Loading…
Reference in New Issue
Block a user