From a00ffdaa17c7ac96bb86734bac08a90c7785c98a Mon Sep 17 00:00:00 2001
From: Cyril Roelandt <tipecaml@gmail.com>
Date: Sat, 27 Sep 2014 23:04:46 +0200
Subject: [PATCH] guix lint: Make sure a synopsis cannot start with a
 lower-case article.

* guix/scripts/lint.scm (check-start-article): use "string-ci=?" instead of
  "string=?".
* tests/lint.scm ("synopsis: starts with 'a'",
  "synopsis: starts with 'an'"): New tests.
---
 guix/scripts/lint.scm |  4 ++--
 tests/lint.scm        | 18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 1124654d75b..3f0a8d4fc0e 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -148,8 +148,8 @@ (define (check-final-period synopsis)
                       'synopsis)))
 
   (define (check-start-article synopsis)
-   (if (or (string=? (string-take synopsis 2) "A ")
-           (string=? (string-take synopsis 3) "An "))
+   (if (or (string-ci=? (string-take synopsis 2) "A ")
+           (string-ci=? (string-take synopsis 3) "An "))
        (emit-warning package
                      "no article allowed at the beginning of the synopsis"
                      'synopsis)))
diff --git a/tests/lint.scm b/tests/lint.scm
index ceb7abe23e1..c439faa30ee 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -97,6 +97,24 @@ (define (call-with-warnings thunk)
                         (check-synopsis-style pkg))))
                     "no article allowed at the beginning of the synopsis")))
 
+(test-assert "synopsis: starts with 'a'"
+  (->bool
+   (string-contains (call-with-warnings
+                      (lambda ()
+                        (let ((pkg (dummy-package "x"
+                                     (synopsis "a bad synopsis"))))
+                        (check-synopsis-style pkg))))
+                    "no article allowed at the beginning of the synopsis")))
+
+(test-assert "synopsis: starts with 'an'"
+  (->bool
+   (string-contains (call-with-warnings
+                      (lambda ()
+                        (let ((pkg (dummy-package "x"
+                                     (synopsis "an awful synopsis"))))
+                        (check-synopsis-style pkg))))
+                    "no article allowed at the beginning of the synopsis")))
+
 (test-assert "synopsis: too long"
   (->bool
    (string-contains (call-with-warnings
-- 
GitLab