[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/11: lint: Rewrite 'check-patch-file-names'.
From: |
Mathieu Lirzin |
Subject: |
03/11: lint: Rewrite 'check-patch-file-names'. |
Date: |
Thu, 28 Jan 2016 15:32:42 +0000 |
mthl pushed a commit to branch master
in repository guix.
commit f3044a4b7b4fd8b51a65c95bca1d22b252863dc9
Author: Mathieu Lirzin <address@hidden>
Date: Sun Jan 24 15:15:54 2016 +0100
lint: Rewrite 'check-patch-file-names'.
* guix/scripts/lint.scm (check-patch-file-names): Improve clarity by
reversing the logic.
---
guix/scripts/lint.scm | 29 +++++++++++++----------------
1 files changed, 13 insertions(+), 16 deletions(-)
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 25f49a7..e729398 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -413,24 +413,21 @@ warning for PACKAGE mentionning the FIELD."
(define (check-patch-file-names package)
"Emit a warning if the patches requires by PACKAGE are badly named or if the
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)
'patch-file-names)))
- (let ((patches (and=> (package-source package) origin-patches))
- (name (package-name package)))
- (when (and patches
- (any (match-lambda
- ((? string? patch)
- (let ((file (basename patch)))
- (not (eq? (string-contains file name) 0))))
- (_
- ;; This must be an <origin> or something like that.
- #f))
- patches))
- (emit-warning package
- (_ "file names of patches should start with \
-the package name")
- 'patch-file-names)))))
+ (unless (every (match-lambda ;patch starts with package name?
+ ((? string? patch)
+ (and=> (string-contains (basename patch)
+ (package-name package))
+ zero?))
+ (_ #f)) ;must be an <origin> or something like that.
+ (or (and=> (package-source package) origin-patches)
+ '()))
+ (emit-warning
+ package
+ (_ "file names of patches should start with the package name")
+ 'patch-file-names))))
(define (escape-quotes str)
"Replace any quote character in STR by an escaped quote character."
- 01/11: tests: Use 'dummy-origin' for lint tests when possible., (continued)
- 01/11: tests: Use 'dummy-origin' for lint tests when possible., Mathieu Lirzin, 2016/01/28
- 02/11: lint: Remove an unneeded clause in 'check-patch-file-names'., Mathieu Lirzin, 2016/01/28
- 06/11: build: Add 'DOT' silent rule., Mathieu Lirzin, 2016/01/28
- 08/11: build: Add 'HELP2MAN' silent rule., Mathieu Lirzin, 2016/01/28
- 07/11: build: Add 'EMACS' silent rule., Mathieu Lirzin, 2016/01/28
- 05/11: build: Add 'DL' silent rule., Mathieu Lirzin, 2016/01/28
- 11/11: Update .gitignore., Mathieu Lirzin, 2016/01/28
- 04/11: packages: Use '@' in package record printers., Mathieu Lirzin, 2016/01/28
- 10/11: build: Use 'GEN' and 'at' silent rules., Mathieu Lirzin, 2016/01/28
- 09/11: build: Remove guix-autoloads.el from the distribution., Mathieu Lirzin, 2016/01/28
- 03/11: lint: Rewrite 'check-patch-file-names'.,
Mathieu Lirzin <=