guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] guix lint: add the --checkers option.


From: Ludovic Courtès
Subject: Re: [PATCH] guix lint: add the --checkers option.
Date: Sun, 12 Oct 2014 19:02:56 +0200
User-agent: Gnus/5.130011 (Ma Gnus v0.11) Emacs/24.3 (gnu/linux)

Cyril Roelandt <address@hidden> 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.

[...]

> address@hidden --checkers
> address@hidden -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=$(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;
> +# 3) 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’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]