mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2025-01-20 06:37:08 +01:00
guix: lint: Use if/when consistently.
* guix/scripts/lint.scm (check-synopsis-style): Replace single-branch uses of if with when. (check-patches): Same
This commit is contained in:
parent
86a4126348
commit
c04b82ffce
1 changed files with 29 additions and 29 deletions
|
@ -104,24 +104,24 @@ (define (check-synopsis-style package)
|
||||||
;; Emit a warning if stylistic issues are found in the synopsis of PACKAGE.
|
;; Emit a warning if stylistic issues are found in the synopsis of PACKAGE.
|
||||||
(define (check-final-period synopsis)
|
(define (check-final-period synopsis)
|
||||||
;; Synopsis should not end with a period, except for some special cases.
|
;; Synopsis should not end with a period, except for some special cases.
|
||||||
(if (and (string-suffix? "." synopsis)
|
(when (and (string-suffix? "." synopsis)
|
||||||
(not (string-suffix? "etc." synopsis)))
|
(not (string-suffix? "etc." synopsis)))
|
||||||
(emit-warning package
|
(emit-warning package
|
||||||
"no period allowed at the end of the synopsis"
|
"no period allowed at the end of the synopsis"
|
||||||
'synopsis)))
|
'synopsis)))
|
||||||
|
|
||||||
(define (check-start-article synopsis)
|
(define (check-start-article synopsis)
|
||||||
(if (or (string-prefix-ci? "A " synopsis)
|
(when (or (string-prefix-ci? "A " synopsis)
|
||||||
(string-prefix-ci? "An " synopsis))
|
(string-prefix-ci? "An " synopsis))
|
||||||
(emit-warning package
|
(emit-warning package
|
||||||
"no article allowed at the beginning of the synopsis"
|
"no article allowed at the beginning of the synopsis"
|
||||||
'synopsis)))
|
'synopsis)))
|
||||||
|
|
||||||
(define (check-synopsis-length synopsis)
|
(define (check-synopsis-length synopsis)
|
||||||
(if (>= (string-length synopsis) 80)
|
(when (>= (string-length synopsis) 80)
|
||||||
(emit-warning package
|
(emit-warning package
|
||||||
"synopsis should be less than 80 characters long"
|
"synopsis should be less than 80 characters long"
|
||||||
'synopsis)))
|
'synopsis)))
|
||||||
|
|
||||||
(define (check-synopsis-start-upper-case synopsis)
|
(define (check-synopsis-start-upper-case synopsis)
|
||||||
(when (and (not (string-null? synopsis))
|
(when (and (not (string-null? synopsis))
|
||||||
|
@ -137,33 +137,33 @@ (define (check-start-with-package-name synopsis)
|
||||||
'synopsis)))
|
'synopsis)))
|
||||||
|
|
||||||
(let ((synopsis (package-synopsis package)))
|
(let ((synopsis (package-synopsis package)))
|
||||||
(if (string? synopsis)
|
|
||||||
(begin
|
(begin
|
||||||
(check-synopsis-start-upper-case synopsis)
|
(check-synopsis-start-upper-case synopsis)
|
||||||
(check-final-period synopsis)
|
(check-final-period synopsis)
|
||||||
(check-start-article synopsis)
|
(check-start-article synopsis)
|
||||||
(check-start-with-package-name synopsis)
|
(check-start-with-package-name synopsis)
|
||||||
(check-synopsis-length synopsis)))))
|
(check-synopsis-length synopsis)))))
|
||||||
|
(when (string? synopsis)
|
||||||
|
|
||||||
(define (check-patches package)
|
(define (check-patches package)
|
||||||
;; Emit a warning if the patches requires by PACKAGE are badly named.
|
;; Emit a warning if the patches requires by PACKAGE are badly named.
|
||||||
(let ((patches (and=> (package-source package) origin-patches))
|
(let ((patches (and=> (package-source package) origin-patches))
|
||||||
(name (package-name package))
|
(name (package-name package))
|
||||||
(full-name (package-full-name package)))
|
(full-name (package-full-name package)))
|
||||||
(if (and patches
|
(when (and patches
|
||||||
(any (match-lambda
|
(any (match-lambda
|
||||||
((? string? patch)
|
((? string? patch)
|
||||||
(let ((filename (basename patch)))
|
(let ((filename (basename patch)))
|
||||||
(not (or (eq? (string-contains filename name) 0)
|
(not (or (eq? (string-contains filename name) 0)
|
||||||
(eq? (string-contains filename full-name)
|
(eq? (string-contains filename full-name)
|
||||||
0)))))
|
0)))))
|
||||||
(_
|
(_
|
||||||
;; This must be an <origin> or something like that.
|
;; This must be an <origin> or something like that.
|
||||||
#f))
|
#f))
|
||||||
patches))
|
patches))
|
||||||
(emit-warning package
|
(emit-warning package
|
||||||
"file names of patches should start with the package name"
|
"file names of patches should start with the package name"
|
||||||
'patches))))
|
'patches))))
|
||||||
|
|
||||||
(define %checkers
|
(define %checkers
|
||||||
(list
|
(list
|
||||||
|
|
Loading…
Reference in a new issue