[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] lint: Add 'check-texinfo-markup' checker.
From: |
Mathieu Lirzin |
Subject: |
[PATCH] lint: Add 'check-texinfo-markup' checker. |
Date: |
Tue, 15 Sep 2015 17:51:17 +0200 |
* 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(+)
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
"address@hidden"))))
+ "Texinfo markup in description is invalid")))
+
(test-assert "description: does not start with an upper-case letter"
(->bool
(string-contains (with-warnings
- [PATCH] lint: Add 'check-texinfo-markup' checker.,
Mathieu Lirzin <=