guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] lint: Check non-translated package descriptions.


From: Mathieu Lirzin
Subject: [PATCH 1/2] lint: Check non-translated package descriptions.
Date: Tue, 22 Sep 2015 15:44:22 +0200

* guix/ui.scm (texi->plain-text): Export.
* guix/scripts/lint.scm (check-description-style): Use it instead of
  'package-description-string'.
---
 guix/scripts/lint.scm | 17 ++++++++++-------
 guix/ui.scm           |  1 +
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 8224f54..a52a9eb 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -143,12 +143,14 @@ monad."
                     (_ "description should not be empty")
                     'description)))
 
-  (define (check-texinfo-markup package)
-    "Check that PACKAGE description can be parsed as a Texinfo fragment."
+  (define (check-texinfo-markup description)
+    "Check that DESCRIPTION can be parsed as a Texinfo fragment.  If the
+markup is valid return a plain-text version of DESCRIPTION, otherwise #f."
     (catch 'parser-error
-      (lambda () (package-description-string package))
+      (lambda () (texi->plain-text description))
       (lambda (keys . args)
-        (emit-warning package (_ "Texinfo markup in description is 
invalid")))))
+        (emit-warning package (_ "Texinfo markup in description is invalid"))
+        #f)))
 
   (define (check-proper-start description)
     (unless (or (properly-starts-sentence? description)
@@ -179,9 +181,10 @@ 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))))
+      (and=> (check-texinfo-markup description)
+             (lambda (texi)
+               (check-proper-start texi)
+               (check-end-of-sentence-space texi))))))
 
 (define (check-inputs-should-be-native package)
   ;; Emit a warning if some inputs of PACKAGE are likely to belong to its
diff --git a/guix/ui.scm b/guix/ui.scm
index 4a3630f..055f2c2 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -75,6 +75,7 @@
             switch-symlinks
             config-directory
             fill-paragraph
+            texi->plain-text
             package-description-string
             string->recutils
             package->recutils

reply via email to

[Prev in Thread] Current Thread [Next in Thread]