From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] guix lint: add the --checkers option. Date: Sun, 12 Oct 2014 19:02:56 +0200 Message-ID: <87lholxltr.fsf@gnu.org> References: <1413080379-1576-1-git-send-email-tipecaml@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdMXo-0003pd-4Q for guix-devel@gnu.org; Sun, 12 Oct 2014 13:03:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XdMXi-0000gv-E5 for guix-devel@gnu.org; Sun, 12 Oct 2014 13:02:56 -0400 Received: from hera.aquilenet.fr ([2a01:474::1]:55869) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XdMXi-0000f3-77 for guix-devel@gnu.org; Sun, 12 Oct 2014 13:02:50 -0400 In-Reply-To: <1413080379-1576-1-git-send-email-tipecaml@gmail.com> (Cyril Roelandt's message of "Sun, 12 Oct 2014 04:19:39 +0200") 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: Cyril Roelandt Cc: guix-devel@gnu.org Cyril Roelandt skribis: > * guix/scripts/lint.scm: add the "--checkers" option. > * doc/guix.texi: Update "Invoking guix lint". Rather: * doc/guix.texi (Invoking guix lint): Document it. > * tests/guix-lint.sh: New file > * Makefile.am (SCM_TESTS): Add it. [...] > +@item --checkers > +@itemx -c > +Only enable the checkers specified in a comma-separated list using the > +names returned by --list-checkers. Should be @code{--list-checkers}. > + (begin > + (format (current-error-port) > + "Invalid checker: ~a~%" c) > + (exit 1)))) Use (leave (_ "~a: invalid checker") c) instead. > + (let ((checkers (or (assoc-ref opts 'checkers) %checkers))) > + (if (null? args) > + (fold-packages (lambda (p r) (run-checkers p checkers)) '()) Indent -1. > + (for-each > + (lambda (spec) > + (run-checkers spec checkers)) > + (map specification->package args)))))) Both should be combined, as in: (for-each (lambda (spec) (run-checkers (specification->package spec) checkers)) args) > +grep_warning () > +{ > + res=3D$(echo "$1" | grep -E -c "(synopsis|description) should") > + echo $res $(...) is a Bash extension; please use backquotes instead. > +# Three issues with the dummy package: > +# 1) the synopsis starts with the package name; > +# 2) the synopsis starts with a lower-case letter; > +#=C2=A03) the description starts with a lower-case letter. > + > +if [ $(grep_warning "$(guix lint dummy 2>&1)") -ne 3 ] > +then false; else true; fi > + > +if [ $(grep_warning "$(guix lint -c synopsis dummy 2>&1)") -ne 2 ] > +then false; else true; fi > + > +if [ $(grep_warning "$(guix lint -c description dummy 2>&1)") -ne 1 ] > +then false; else true; fi > + > +if [ $(grep_warning "$(guix lint -c description,synopsis dummy 2>&1)") -= ne 3 ] > +then false; else true; fi Backquotes as well (with intermediate variables.) > +if guix lint -c synopsis,invalid-checker dummy 2>&1 | \ > + grep -q 'Invalid checker: invalid-checker' > +then true; else false; fi OK. Could you send an updated patch? Thanks, Ludo=E2=80=99.