scripts: lint: Fix '--no-network' option.

* guix/scripts/lint.scm: (show-help): Add '--no-network' option message.
(%options, parse-options): Fix argument order.
* doc/guix.texi (Invoking guix lint): Document it.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
zimoun 2020-10-28 17:51:11 +01:00 committed by Ludovic Courtès
parent 61e839a9f9
commit 80c7f02468
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 16 additions and 6 deletions

View file

@ -11528,6 +11528,10 @@ and exit.
Only enable the checkers specified in a comma-separated list using the
names returned by @option{--list-checkers}.
@item --no-network
@itemx -n
Only enable the checkers that do not depend on Internet access.
@item --load-path=@var{directory}
@itemx -L @var{directory}
Add @var{directory} to the front of the package module search path

View file

@ -9,7 +9,7 @@
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
;;; Copyright © 2019 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2019, 2020 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@ -98,6 +98,9 @@ (define (show-help)
(display (G_ "
-c, --checkers=CHECKER1,CHECKER2...
only run the specified checkers"))
(display (G_ "
-n, --no-network only run checkers that do not access the network"))
(display (G_ "
-L, --load-path=DIR prepend DIR to the package module search path"))
(newline)
@ -132,10 +135,7 @@ (define %options
result))))
(option '(#\n "no-network") #f #f
(lambda (opt name arg result)
(alist-cons 'checkers
%local-checkers
(alist-delete 'checkers
result))))
(alist-cons 'no-network? #t result)))
(find (lambda (option)
(member "load-path" (option-names option)))
%standard-build-options)
@ -172,7 +172,13 @@ (define (parse-options)
value)
(_ #f))
(reverse opts)))
(checkers (or (assoc-ref opts 'checkers) %all-checkers)))
(the-checkers (or (assoc-ref opts 'checkers) %all-checkers))
(checkers
(if (assoc-ref opts 'no-network?)
(filter (lambda (checker)
(member checker %local-checkers))
the-checkers)
the-checkers)))
(when (assoc-ref opts 'list?)
(list-checkers-and-exit checkers))