From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id FqcNFM52Vl8LYwAA0tVLHw (envelope-from ) for ; Mon, 07 Sep 2020 18:07:10 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id YIWcD852Vl86AQAA1q6Kng (envelope-from ) for ; Mon, 07 Sep 2020 18:07:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id CF2CD9400EF for ; Mon, 7 Sep 2020 18:07:09 +0000 (UTC) Received: from localhost ([::1]:53136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFLXo-000703-5R for larch@yhetil.org; Mon, 07 Sep 2020 14:07:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38706) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFLVn-0003fD-DV for guix-patches@gnu.org; Mon, 07 Sep 2020 14:05:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39241) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kFLVn-0002NG-3u for guix-patches@gnu.org; Mon, 07 Sep 2020 14:05:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kFLVm-0001NZ-Vx for guix-patches@gnu.org; Mon, 07 Sep 2020 14:05:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43261] [PATCH 2/2] lint: Add '--no-checkers' option. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 07 Sep 2020 18:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43261 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43261@debbugs.gnu.org Cc: zimoun Received: via spool by 43261-submit@debbugs.gnu.org id=B43261.15995018695247 (code B ref 43261); Mon, 07 Sep 2020 18:05:02 +0000 Received: (at 43261) by debbugs.gnu.org; 7 Sep 2020 18:04:29 +0000 Received: from localhost ([127.0.0.1]:50786 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFLVF-0001MZ-HT for submit@debbugs.gnu.org; Mon, 07 Sep 2020 14:04:29 -0400 Received: from mail-wr1-f42.google.com ([209.85.221.42]:43502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kFLVC-0001M9-FJ for 43261@debbugs.gnu.org; Mon, 07 Sep 2020 14:04:26 -0400 Received: by mail-wr1-f42.google.com with SMTP id k15so16586317wrn.10 for <43261@debbugs.gnu.org>; Mon, 07 Sep 2020 11:04:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0+gBuyxHRQR/4An91U5JdjYh2yhy0EhPtR0Wm9zPOKw=; b=pSJlKt3vfMKnuFJnRkG7dtuKUf8Ki7l93ea+q3xUGlpxwv7vZbZGQNnovHW/jp8zVV a1VLMTNysUHU/maCV0ky/x3Pu6i+FH+mLjyLKwwYd8vEi/CWXtWc5c9GtblPLZWnuq+A MjLiOG8WMe7GZg5kwg5Dg8qCNZ+htou7SKUkrkfIy/VrQC01aRTC//YcegT5bLwYGkpy gBaUY8rhCLTzH3DGEklJukC7HmBiYK4cIw58KtCkxJ4s0NyL1pF7tuebSF10uq0hDxD8 jfu9709eV/kC5SJrTRgVKYpObjnV/gZLRGD1TH5OfD/Xl7RtJK5yeV76vmduzO4ChKYA 6iiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0+gBuyxHRQR/4An91U5JdjYh2yhy0EhPtR0Wm9zPOKw=; b=GbzqiNe2evTJx+/YZXu+AnmSbhngUJ/ythxw+T6NWTY5ZwLr5cOrmwJUkJrR6Sxisk wgjg9SnQ+rto+BGLv5yxijkN4QwnZn6KDHFgvZe439GR2+gKCXKme3IWkYbE1neOYqLG O9IMuu4pZQux32Z7xzahl8KwsgRlxaTav7kFvNEornbI/08bgqxjUzmpaU/BhnG7YwCM 5hxzpa4JP3kD+dPXG74z12s2S2eIQTztA/9WCEmE1aOzEdLhbH5wjl9ZEl4zywjlOYgt bDcB9L5fLMSWG7x1Y0ZZE5XpeZ1lgNB2g9rPQiF5MYzFhMbuE5X4zSXtOvJKqvaojuvA jmBw== X-Gm-Message-State: AOAM5337pL95olA9s2q6PuKOMmuzJSm8ITN0rhhMyLLnRQxXW0j7sylH 7coYfXbM3wG9pKjK1Tq4ntOjCoXn790= X-Google-Smtp-Source: ABdhPJx+lYLXfl2RcUkG3TeHrKaLqLfv7zFUDkM3pWkkrqG86LzxlMQJ720Z08nY/6Wt+ltEFyKYtw== X-Received: by 2002:a5d:4246:: with SMTP id s6mr22465498wrr.414.1599501860639; Mon, 07 Sep 2020 11:04:20 -0700 (PDT) Received: from pfiuh02.univ-paris-diderot.fr ([193.48.40.241]) by smtp.gmail.com with ESMTPSA id u126sm35778838wmu.9.2020.09.07.11.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2020 11:04:20 -0700 (PDT) From: zimoun Date: Mon, 7 Sep 2020 20:04:15 +0200 Message-Id: <20200907180415.30140-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200907180415.30140-1-zimon.toutoune@gmail.com> References: <20200907180415.30140-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=pSJlKt3v; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 4.09 X-TUID: pMRZAKnqNYkW * guix/scripts/lint.scm (%options, parse-options): Add '--no-checkers' option. * doc/guix.texi: Document it. --- doc/guix.texi | 5 +++++ guix/scripts/lint.scm | 39 ++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ea2aa1581e..bcc6fe8324 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10632,6 +10632,11 @@ and exit. Only enable the checkers specified in a comma-separated list using the names returned by @option{--list-checkers}. +@item --no-checkers +@itemx -x +Only disable 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 which do not dependent on Internet access. diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index c56576fcbd..0007e18bcd 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -99,6 +99,9 @@ run the checkers on all packages.\n")) -c, --checkers=CHECKER1,CHECKER2... only run the specified checkers")) (display (G_ " + -x, --no-checkers=CHECKER1,CHECKER2... + exclude the specified checkers")) + (display (G_ " -n, --no-network only run checkers which do not access to network")) (display (G_ " @@ -113,26 +116,29 @@ run the checkers on all packages.\n")) (newline) (show-bug-report-information)) +(define (option-checker short-long) + (option short-long #t #f + (lambda (opt name arg result) + (let ((names (map string->symbol (string-split arg #\,))) + (checker-names (map lint-checker-name %all-checkers))) + (for-each (lambda (c) + (unless (memq c checker-names) + (leave (G_ "~a: invalid checker~%") c))) + names) + (alist-cons (string->symbol (cadr short-long)) + (filter (lambda (checker) + (member (lint-checker-name checker) + names)) + %all-checkers) + result))))) (define %options ;; Specification of the command-line options. ;; TODO: add some options: ;; * --certainty=[low,medium,high]: only run checkers that have at least this ;; 'certainty'. - (list (option '(#\c "checkers") #t #f - (lambda (opt name arg result) - (let ((names (map string->symbol (string-split arg #\,))) - (checker-names (map lint-checker-name %all-checkers))) - (for-each (lambda (c) - (unless (memq c checker-names) - (leave (G_ "~a: invalid checker~%") c))) - names) - (alist-cons 'checkers - (filter (lambda (checker) - (member (lint-checker-name checker) - names)) - %all-checkers) - result)))) + (list (option-checker '(#\c "checkers")) + (option-checker '(#\x "no-checkers")) (option '(#\n "no-network") #f #f (lambda (opt name arg result) (alist-cons 'no-network? #t result))) @@ -169,7 +175,10 @@ run the checkers on all packages.\n")) value) (_ #f)) (reverse opts))) - (the-checkers (or (assoc-ref opts 'checkers) %all-checkers)) + (no-checkers (or (assoc-ref opts 'no-checkers) '())) + (the-checkers (filter (lambda (checker) + (not (member checker no-checkers))) + (or (assoc-ref opts 'checkers) %all-checkers))) (checkers (if (assoc-ref opts 'no-network?) (filter (lambda (checker) -- 2.28.0