unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [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

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 public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).