mirror of
https://git.savannah.gnu.org/git/guix.git
synced 2026-04-06 21:20:33 +02:00
lint: Ignore initials from double space check.
Prevent false positives in initials as the are commonly used in names, e.g. Margaret E. Hamilton - which obviously do not end sentences. Check whether a period character `.' is preceded by at least two characters. This should save us from false positives when linting. * guix/lint.scm(check-description-style)[check-end-of-sentence-space] Add condition. * tests/lint.scm: Add test case. Change-Id: I42a1365aaaed2afc7308b88ebd4b0720ad362761 Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
committed by
Ludovic Courtès
parent
27b4c319c0
commit
9447629672
@@ -466,11 +466,16 @@ trademark sign '~a' at ~d")
|
|||||||
(reverse (fold-matches
|
(reverse (fold-matches
|
||||||
"\\. [A-Z]" description '()
|
"\\. [A-Z]" description '()
|
||||||
(lambda (m r)
|
(lambda (m r)
|
||||||
;; Filter out matches of common abbreviations.
|
;; Filter out matches of common abbreviations and
|
||||||
(if (find (lambda (s)
|
;; initials.
|
||||||
(string-suffix-ci? s (match:prefix m)))
|
(let ((pre (match:prefix m)))
|
||||||
'("i.e" "e.g" "a.k.a" "resp"))
|
(if (or
|
||||||
r (cons (match:start m) r)))))))
|
(string-match "[A-Z]$" pre) ;; Initial found
|
||||||
|
(find (lambda (s)
|
||||||
|
(string-suffix-ci? s pre))
|
||||||
|
'("i.e" "e.g" "a.k.a" "resp")))
|
||||||
|
r
|
||||||
|
(cons (match:start m) r))))))))
|
||||||
(if (null? infractions)
|
(if (null? infractions)
|
||||||
'()
|
'()
|
||||||
(list
|
(list
|
||||||
|
|||||||
@@ -173,7 +173,7 @@
|
|||||||
'()
|
'()
|
||||||
(let ((pkg (dummy-package "x"
|
(let ((pkg (dummy-package "x"
|
||||||
(description
|
(description
|
||||||
"E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD)."))))
|
"E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD). Name O. Person"))))
|
||||||
(check-description-style pkg)))
|
(check-description-style pkg)))
|
||||||
|
|
||||||
(test-equal "description: may not contain trademark signs: ™"
|
(test-equal "description: may not contain trademark signs: ™"
|
||||||
|
|||||||
Reference in New Issue
Block a user