lint: Rewrite 'check-patch-file-names'.
* guix/scripts/lint.scm (check-patch-file-names): Improve clarity by reversing the logic.
This commit is contained in:
parent
90ca918668
commit
f3044a4b7b
|
@ -416,21 +416,18 @@ patch could not be found."
|
||||||
(guard (c ((message-condition? c) ;raised by 'search-patch'
|
(guard (c ((message-condition? c) ;raised by 'search-patch'
|
||||||
(emit-warning package (condition-message c)
|
(emit-warning package (condition-message c)
|
||||||
'patch-file-names)))
|
'patch-file-names)))
|
||||||
(let ((patches (and=> (package-source package) origin-patches))
|
(unless (every (match-lambda ;patch starts with package name?
|
||||||
(name (package-name package)))
|
|
||||||
(when (and patches
|
|
||||||
(any (match-lambda
|
|
||||||
((? string? patch)
|
((? string? patch)
|
||||||
(let ((file (basename patch)))
|
(and=> (string-contains (basename patch)
|
||||||
(not (eq? (string-contains file name) 0))))
|
(package-name package))
|
||||||
(_
|
zero?))
|
||||||
;; This must be an <origin> or something like that.
|
(_ #f)) ;must be an <origin> or something like that.
|
||||||
#f))
|
(or (and=> (package-source package) origin-patches)
|
||||||
patches))
|
'()))
|
||||||
(emit-warning package
|
(emit-warning
|
||||||
(_ "file names of patches should start with \
|
package
|
||||||
the package name")
|
(_ "file names of patches should start with the package name")
|
||||||
'patch-file-names)))))
|
'patch-file-names))))
|
||||||
|
|
||||||
(define (escape-quotes str)
|
(define (escape-quotes str)
|
||||||
"Replace any quote character in STR by an escaped quote character."
|
"Replace any quote character in STR by an escaped quote character."
|
||||||
|
|
Loading…
Reference in New Issue