From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH 5/5] guix lint: make sure synopses do not start with the package name. Date: Sat, 27 Sep 2014 23:49:28 +0200 Message-ID: <1411854568-11187-6-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]:48585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXzsU-00083H-94 for guix-devel@gnu.org; Sat, 27 Sep 2014 17:50:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXzsJ-00030r-V2 for guix-devel@gnu.org; Sat, 27 Sep 2014 17:50:06 -0400 Received: from mail-wg0-x22e.google.com ([2a00:1450:400c:c00::22e]:63115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXzsJ-0002zt-PR for guix-devel@gnu.org; Sat, 27 Sep 2014 17:49:55 -0400 Received: by mail-wg0-f46.google.com with SMTP id k14so1108398wgh.29 for ; Sat, 27 Sep 2014 14:49:49 -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-with-package-name): New method. * tests/lint.scm: Test it. --- guix/scripts/lint.scm | 9 +++++++++ tests/lint.scm | 10 ++++++++++ 2 files changed, 19 insertions(+) diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index ee00e5c..8f49afc 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -167,12 +167,21 @@ Run a set of checkers on the specified package; if none is specified, run the ch "synopsis should start with an upper-case letter" 'synopsis))) + (define (check-start-with-package-name synopsis) + (let ((idx (string-contains-ci synopsis (package-name package)))) + (when (and idx + (= idx 0)) + (emit-warning package + "synopsis should not start with the package name") + 'synopsis))) + (let ((synopsis (package-synopsis package))) (if (string? synopsis) (begin (check-synopsis-start-upper-case synopsis) (check-final-period synopsis) (check-start-article synopsis) + (check-start-with-package-name synopsis) (check-synopsis-length synopsis))))) (define (check-patches package) diff --git a/tests/lint.scm b/tests/lint.scm index c439faa..62a9df9 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -124,6 +124,16 @@ (check-synopsis-style pkg)))) "synopsis should be less than 80 characters long"))) +(test-assert "synopsis: start with package name" + (->bool + (string-contains (call-with-warnings + (lambda () + (let ((pkg (dummy-package "x" + (name "foo") + (synopsis "foo, a nice package")))) + (check-synopsis-style pkg)))) + "synopsis should not start with the package name"))) + (test-assert "inputs: pkg-config is probably a native input" (->bool (string-contains -- 1.8.4.rc3