diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-11-07 14:09:19 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-11-07 17:52:11 +0100 |
commit | 17854ef91dd6b8e8956ef38bd7a7db59fb43f114 (patch) | |
tree | 9651a321f9d66153e8a55746e951765e8ba68f62 /guix | |
parent | 72b030c0495837191ea360e71fd6c786ec063edc (diff) | |
download | gnu-guix-17854ef91dd6b8e8956ef38bd7a7db59fb43f114.tar gnu-guix-17854ef91dd6b8e8956ef38bd7a7db59fb43f114.tar.gz |
lint: Improve check for synopses starting with package name.
* guix/scripts/lint.scm (package-name-regexp): New procedure.
(check-synopsis-style)[check-start-with-package-name]: Use it instead
of 'string-prefix-ci?'.
* tests/lint.scm ("synopsis: start with package name prefix"): New test.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/scripts/lint.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 7f5915ba2e..35ab9aaf69 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -131,6 +131,12 @@ by two spaces; possible infraction~p at ~{~a~^, ~}" "pkg-config should probably be a native input" 'inputs)))))) +(define (package-name-regexp package) + "Return a regexp that matches PACKAGE's name as a word at the beginning of a +line." + (make-regexp (string-append "^" (regexp-quote (package-name package)) + "\\>") + regexp/icase)) (define (check-synopsis-style package) ;; Emit a warning if stylistic issues are found in the synopsis of PACKAGE. @@ -168,7 +174,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}" 'synopsis))) (define (check-start-with-package-name synopsis) - (when (string-prefix-ci? (package-name package) synopsis) + (when (regexp-exec (package-name-regexp package) synopsis) (emit-warning package "synopsis should not start with the package name" 'synopsis))) |