From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH 4/5] guix lint: Make sure a synopsis cannot start with a lower-case article. Date: Sat, 27 Sep 2014 23:49:27 +0200 Message-ID: <1411854568-11187-5-git-send-email-tipecaml@gmail.com> References: <1411854568-11187-1-git-send-email-tipecaml@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48583) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXzsU-00083G-6p for guix-devel@gnu.org; Sat, 27 Sep 2014 17:50:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXzsI-00030S-Iq for guix-devel@gnu.org; Sat, 27 Sep 2014 17:50:06 -0400 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:55763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXzsI-0002zX-CO for guix-devel@gnu.org; Sat, 27 Sep 2014 17:49:54 -0400 Received: by mail-wi0-f179.google.com with SMTP id d1so1272880wiv.6 for ; Sat, 27 Sep 2014 14:49:48 -0700 (PDT) In-Reply-To: <1411854568-11187-1-git-send-email-tipecaml@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * guix/scripts/lint.scm (check-start-article): use "string-ci=?" instead of "string=?". * tests/lint.scm: Add corresponding 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 5f9b6e4..ee00e5c 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -148,8 +148,8 @@ Run a set of checkers on the specified package; if none is specified, run the ch '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 ceb7abe..c439faa 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -97,6 +97,24 @@ (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 -- 1.8.4.rc3