summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-11-07 17:44:30 +0100
committerLudovic Courtès <ludo@gnu.org>2014-11-07 17:52:11 +0100
commit15a6d433ff33c44ffef406ad77e196d6a5ef0822 (patch)
tree7b1f6774ff5c064e24b5f2dac9f83ab96a94d70b
parent105c260f00479d404b140be534efb21f9f3d17fe (diff)
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.
-rw-r--r--guix/scripts/lint.scm7
-rw-r--r--tests/lint.scm10
2 files changed, 16 insertions, 1 deletions
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 350a35222cf..237709848f9 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -80,6 +80,10 @@
80(define (properly-starts-sentence? s) 80(define (properly-starts-sentence? s)
81 (string-match "^[(\"'[:upper:][:digit:]]" s)) 81 (string-match "^[(\"'[:upper:][:digit:]]" s))
82 82
83(define (starts-with-abbreviation? s)
84 "Return #t if S starts with what looks like an abbreviation or acronym."
85 (string-match "^[A-Z][A-Z0-9]+\\>" s))
86
83(define (check-description-style package) 87(define (check-description-style package)
84 ;; Emit a warning if stylistic issues are found in the description of PACKAGE. 88 ;; Emit a warning if stylistic issues are found in the description of PACKAGE.
85 (define (check-not-empty description) 89 (define (check-not-empty description)
@@ -180,7 +184,8 @@ line."
180 'synopsis))) 184 'synopsis)))
181 185
182 (define (check-start-with-package-name synopsis) 186 (define (check-start-with-package-name synopsis)
183 (when (regexp-exec (package-name-regexp package) synopsis) 187 (when (and (regexp-exec (package-name-regexp package) synopsis)
188 (not (starts-with-abbreviation? synopsis)))
184 (emit-warning package 189 (emit-warning package
185 "synopsis should not start with the package name" 190 "synopsis should not start with the package name"
186 'synopsis))) 191 'synopsis)))
diff --git a/tests/lint.scm b/tests/lint.scm
index 9a043c4b59a..e77d443264a 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -202,6 +202,16 @@
202 (synopsis "Arbitrary precision")))) 202 (synopsis "Arbitrary precision"))))
203 (check-synopsis-style pkg)))))) 203 (check-synopsis-style pkg))))))
204 204
205(test-assert "synopsis: start with abbreviation"
206 (string-null?
207 (call-with-warnings
208 (lambda ()
209 (let ((pkg (dummy-package "uucp"
210 ;; Same problem with "APL interpreter", etc.
211 (synopsis "UUCP implementation")
212 (description "Imagine this is Taylor UUCP."))))
213 (check-synopsis-style pkg))))))
214
205(test-assert "inputs: pkg-config is probably a native input" 215(test-assert "inputs: pkg-config is probably a native input"
206 (->bool 216 (->bool
207 (string-contains 217 (string-contains