From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH 2/5] guix lint: Make sure synopses are not too long. Date: Sat, 27 Sep 2014 23:49:25 +0200 Message-ID: <1411854568-11187-3-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]:48577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXzsU-000834-25 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 1XXzsF-0002zz-NH for guix-devel@gnu.org; Sat, 27 Sep 2014 17:50:06 -0400 Received: from mail-we0-x231.google.com ([2a00:1450:400c:c03::231]:44640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXzsF-0002zL-GR for guix-devel@gnu.org; Sat, 27 Sep 2014 17:49:51 -0400 Received: by mail-we0-f177.google.com with SMTP id t60so11210876wes.36 for ; Sat, 27 Sep 2014 14:49:45 -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-synopsis-length): New procedure. * tests/lint.scm: test it. --- guix/scripts/lint.scm | 9 ++++++++- tests/lint.scm | 9 +++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 0fbec1b..12391ef 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -140,11 +140,18 @@ Run a set of checkers on the specified package; if none is specified, run the ch "no article allowed at the beginning of the synopsis" 'synopsis))) + (define (check-synopsis-length synopsis) + (if (>= (string-length synopsis) 80) + (emit-warning package + "synopsis should be less than 80 characters long" + 'synopsis))) + (let ((synopsis (package-synopsis package))) (if (string? synopsis) (begin (check-final-period synopsis) - (check-start-article synopsis))))) + (check-start-article synopsis) + (check-synopsis-length synopsis))))) (define (check-patches package) ;; Emit a warning if the patches requires by PACKAGE are badly named. diff --git a/tests/lint.scm b/tests/lint.scm index 56558c9..e082908 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -79,6 +79,15 @@ (check-synopsis-style pkg)))) "no article allowed at the beginning of the synopsis"))) +(test-assert "synopsis: too long" + (->bool + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (synopsis (make-string 80 #\x))))) + (check-synopsis-style pkg)))) + "synopsis should be less than 80 characters long"))) + (test-assert "inputs: pkg-config is probably a native input" (->bool (string-contains -- 1.8.4.rc3