* [PATCH] lint: Add 'check-texinfo-markup' checker.
@ 2015-09-15 15:51 Mathieu Lirzin
2015-09-15 16:57 ` Ludovic Courtès
2015-09-17 8:23 ` Ludovic Courtès
0 siblings, 2 replies; 4+ messages in thread
From: Mathieu Lirzin @ 2015-09-15 15:51 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 234 bytes --]
* guix/script/lint.scm (check-description-style): Check for invalid
Texinfo markup.
* tests/lint.scm: Test it.
---
guix/scripts/lint.scm | 8 ++++++++
tests/lint.scm | 7 +++++++
2 files changed, 15 insertions(+)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lint-Add-check-texinfo-markup-checker.patch --]
[-- Type: text/x-patch; name="0001-lint-Add-check-texinfo-markup-checker.patch", Size: 1748 bytes --]
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index ab7d7c6..e8582cd 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -141,6 +141,13 @@ monad."
(_ "description should not be empty")
'description)))
+ (define (check-texinfo-markup package)
+ "Check that PACKAGE description can be parsed as a Texinfo fragment."
+ (catch 'parser-error
+ (lambda () (package-description-string package))
+ (lambda (keys . args)
+ (emit-warning package (_ "Texinfo markup in description is invalid")))))
+
(define (check-proper-start description)
(unless (or (properly-starts-sentence? description)
(string-prefix-ci? (package-name package) description))
@@ -170,6 +177,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
(let ((description (package-description package)))
(when (string? description)
(check-not-empty description)
+ (check-texinfo-markup package)
(check-proper-start description)
(check-end-of-sentence-space description))))
diff --git a/tests/lint.scm b/tests/lint.scm
index 76040c1..3f8ae7a 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -142,6 +142,13 @@ requests."
(check-description-style pkg)))
"description should not be empty")))
+(test-assert "description: valid Texinfo markup"
+ (->bool
+ (string-contains
+ (with-warnings
+ (check-description-style (dummy-package "x" (description "f{oo}b@r"))))
+ "Texinfo markup in description is invalid")))
+
(test-assert "description: does not start with an upper-case letter"
(->bool
(string-contains (with-warnings
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] lint: Add 'check-texinfo-markup' checker.
2015-09-15 15:51 [PATCH] lint: Add 'check-texinfo-markup' checker Mathieu Lirzin
@ 2015-09-15 16:57 ` Ludovic Courtès
2015-09-17 8:23 ` Ludovic Courtès
1 sibling, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2015-09-15 16:57 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: guix-devel
Mathieu Lirzin <mthl@openmailbox.org> skribis:
> * guix/script/lint.scm (check-description-style): Check for invalid
> Texinfo markup.
> * tests/lint.scm: Test it.
LGTM, thanks!
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lint: Add 'check-texinfo-markup' checker.
2015-09-15 15:51 [PATCH] lint: Add 'check-texinfo-markup' checker Mathieu Lirzin
2015-09-15 16:57 ` Ludovic Courtès
@ 2015-09-17 8:23 ` Ludovic Courtès
2015-09-17 20:39 ` Mathieu Lirzin
1 sibling, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2015-09-17 8:23 UTC (permalink / raw)
To: Mathieu Lirzin; +Cc: guix-devel
Howdy!
I realized that it would be nice if, in ‘check-description-style’, all
the tests except ‘check-not-empty’ and ‘check-texinfo-markup’ would run
on the rendered but non-translated description (and of course, only if
the Texinfo markup is valid.)
WDYT?
In the same area, I think ‘check-proper-start’ should accept quotation
marks at the beginning.
(This came to mind as I wrote a description like this:
"@code{deferred.el} does foo bar".)
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] lint: Add 'check-texinfo-markup' checker.
2015-09-17 8:23 ` Ludovic Courtès
@ 2015-09-17 20:39 ` Mathieu Lirzin
0 siblings, 0 replies; 4+ messages in thread
From: Mathieu Lirzin @ 2015-09-17 20:39 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
ludo@gnu.org (Ludovic Courtès) writes:
> I realized that it would be nice if, in ‘check-description-style’, all
> the tests except ‘check-not-empty’ and ‘check-texinfo-markup’ would run
> on the rendered but non-translated description (and of course, only if
> the Texinfo markup is valid.)
>
> WDYT?
It seems like a good idea.
> In the same area, I think ‘check-proper-start’ should accept quotation
> marks at the beginning.
> (This came to mind as I wrote a description like this:
> "@code{deferred.el} does foo bar".)
I will give it a try. Thanks for the suggestions.
--
Mathieu Lirzin
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-17 21:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-15 15:51 [PATCH] lint: Add 'check-texinfo-markup' checker Mathieu Lirzin
2015-09-15 16:57 ` Ludovic Courtès
2015-09-17 8:23 ` Ludovic Courtès
2015-09-17 20:39 ` Mathieu Lirzin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.