From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Bavier Subject: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions. Date: Fri, 24 Oct 2014 00:06:54 -0500 Message-ID: <87vbnaxdht.fsf@member.fsf.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhX32-0001Ev-MA for Guix-devel@gnu.org; Fri, 24 Oct 2014 01:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhX2w-0003YM-W4 for Guix-devel@gnu.org; Fri, 24 Oct 2014 01:04:24 -0400 Received: from mail-yh0-x232.google.com ([2607:f8b0:4002:c01::232]:49083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhX2w-0003YG-Qr for Guix-devel@gnu.org; Fri, 24 Oct 2014 01:04:18 -0400 Received: by mail-yh0-f50.google.com with SMTP id a41so2628321yho.37 for ; Thu, 23 Oct 2014 22:04:18 -0700 (PDT) Received: from cooper.gmail.com (chippewa-nat.cray.com. [136.162.34.1]) by mx.google.com with ESMTPSA id x193sm1873896iod.17.2014.10.23.22.04.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 Oct 2014 22:04:17 -0700 (PDT) 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0004-guix-lint-Check-for-empty-synopses-and-descriptions.patch >From 94794a8cb470238f60db977b7640202517d379c4 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Wed, 22 Oct 2014 13:48:55 -0500 Subject: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions. * guix/scripts/lint.scm (check-description-style, check-synopsis-style): New emptiness checks. * tests/lint.scm: Test them. --- guix/scripts/lint.scm | 14 ++++++++++++++ tests/lint.scm | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index e8cc853..95eaee3 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -82,6 +82,12 @@ (define (check-description-style package) ;; Emit a warning if stylistic issues are found in the description of PACKAGE. + (define (check-not-empty description) + (when (string-null? description) + (emit-warning package + "description should not be empty" + 'description))) + (define (check-starts-with-upper-case description) (unless (start-with-capital-letter? description) (emit-warning package @@ -110,6 +116,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}" (let ((description (package-description package))) (when (string? description) (begin + (check-not-empty description) (check-starts-with-upper-case description) (check-end-of-sentence-space description))))) @@ -128,6 +135,12 @@ by two spaces; possible infraction~p at ~{~a~^, ~}" (define (check-synopsis-style package) ;; Emit a warning if stylistic issues are found in the synopsis of PACKAGE. + (define (check-not-empty synopsis) + (when (string-null? synopsis) + (emit-warning package + "synopsis should not be empty" + 'synopsis))) + (define (check-final-period synopsis) ;; Synopsis should not end with a period, except for some special cases. (when (and (string-suffix? "." synopsis) @@ -165,6 +178,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}" (let ((synopsis (package-synopsis package))) (if (string? synopsis) (begin + (check-not-empty synopsis) (check-synopsis-start-upper-case synopsis) (check-final-period synopsis) (check-start-article synopsis) diff --git a/tests/lint.scm b/tests/lint.scm index 2c2a179..8ff32ee 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -44,6 +44,15 @@ (thunk)) (get-output-string port))) +(test-assert "description: not empty" + (->bool + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (description "")))) + (check-description-style pkg)))) + "description should not be empty"))) + (test-assert "description: does not start with an upper-case letter" (->bool (string-contains (call-with-warnings @@ -62,6 +71,15 @@ (check-description-style pkg)))) "sentences in description should be followed by two spaces"))) +(test-assert "synopsis: not empty" + (->bool + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (synopsis "")))) + (check-synopsis-style pkg)))) + "synopsis should not be empty"))) + (test-assert "synopsis: does not start with an upper-case letter" (->bool (string-contains (call-with-warnings -- 1.7.9.5 --=-=-= -- Eric Bavier --=-=-=--