From patchwork Fri Jul 19 18:38:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 29383 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B191E27BBE9; Fri, 19 Jul 2024 19:40:35 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0344327BBE2 for ; Fri, 19 Jul 2024 19:40:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUsWZ-0000Xw-Rl; Fri, 19 Jul 2024 14:40:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sUsWY-0000TV-Ls for guix-patches@gnu.org; Fri, 19 Jul 2024 14:40:10 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUsWY-00034x-9w; Fri, 19 Jul 2024 14:40:10 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sUsWQ-0006ch-D2; Fri, 19 Jul 2024 14:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71697] [PATCH v5 1/3] scripts: lint: Add 'dry-run' option. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, pelzflorian@pelzflorian.de, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 19 Jul 2024 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier , Ludovic =?utf-8?q?Court=C3=A8?= =?utf-8?q?s?= Cc: Josselin Poiret , Maxim Cournoyer , Mathieu Othacehe , Tobias Geerinckx-Rice , Florian Pelz , 71697@debbugs.gnu.org, Christopher Baines , Matthew Trzcinski , Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 71697-submit@debbugs.gnu.org id=B71697.172141437525387 (code B ref 71697); Fri, 19 Jul 2024 18:40:02 +0000 Received: (at 71697) by debbugs.gnu.org; 19 Jul 2024 18:39:35 +0000 Received: from localhost ([127.0.0.1]:50872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsVz-0006bO-6A for submit@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:35 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:38257) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsVx-0006bB-4u for 71697@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:33 -0400 Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-36874d7f70bso137530f8f.1 for <71697@debbugs.gnu.org>; Fri, 19 Jul 2024 11:39:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721414308; x=1722019108; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Pp0PurRNNpQ2QH8WxnFjzj2bl8wcDYkfZiT4CBoogTo=; b=CRLDa6NGSYz3FGQclsikDGTW4fSK12lJ47Sw8obhOVMW+Yu1FxCwei7bclDoAcz9H/ rxiRPiilK/ec8Z6Huaz8D9Az0HoFbY0V9yT/sEy/OR7JTn1NJji99QEZvm4JKoF57xqX iYhgNaFC49alBpoj4HlIWEv4I2fs2FJIHH5VFYKhjResiMLF3kAq3FY5CAUcZMnhaZk6 58zGHZvfbEGGmxtonBM6xSI1vvyjFcuesyKsMb+HBB4eUYMFYTZpz7HgqjLtM8z4U6Yx RJdVM+qZZny+b04vVNxhgjxM8urLV0o3E7/3laZZBUv5Z4rSL612qZM9CnvzAPv0918o ry2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721414308; x=1722019108; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Pp0PurRNNpQ2QH8WxnFjzj2bl8wcDYkfZiT4CBoogTo=; b=r1nimXdByOh1YS8XK0UVtdjgzeIyv2AvelbCOV1cWKWkzHbVz2uzHHkgjnLfenQ/TW 0OnxjLq+zvYhRGO11dQzwWUa0xF/AcT4iVZKYx8BP+kth6KIB6wJeBqALDOV80s6rU6e PVgqJTf+hndlQ8cdljan0ZSEyviD2nw7AfcUj0kRuQ4WrzNzlXWbBwaxQeDr5R8GV9W2 FQEbAMUd7IALCRzqegM0Eex/Cc+fYqzvngupLPee80bpKtA87s+y3vQHJ9gvFEmpBOf3 PHnZSoKZa/GmZckZLrKUiU2Z0raRna6r9ElVlIg5tFLGZNy6nVDqM4/G10ei5bOpVo+n k7PA== X-Forwarded-Encrypted: i=1; AJvYcCX6PNpIJmB8dGvSUqa9TnGzKxoRj7Ziadz4eyctn7LJKmwm3RPllvWWhMUsQzqY9vgw6bPSPfPFaTj74f+zFDmfKwc9GSw= X-Gm-Message-State: AOJu0Yzd0QQuaproswHIwQ+7qbtEdFp4yaOim1+MAB9nPFsplb1jju9M UPbDGfm2dCy0OVrEefa6jI8rF5xfqJnaAWxsA/pcEr4f/gSHWXMh X-Google-Smtp-Source: AGHT+IFcGaW9cefsVTD8Mc9xDb3LbhcedQYcLNdhLx1O5FLifzydA9+21D+3tptmInZ6NxyIus2TdA== X-Received: by 2002:a05:600c:3554:b0:426:6cd1:d104 with SMTP id 5b1f17b1804b1-427daa7be1amr1292545e9.4.1721414307827; Fri, 19 Jul 2024 11:38:27 -0700 (PDT) Received: from lili.univ-paris-diderot.fr (roam-nat-fw-prg-194-254-61-42.net.univ-paris-diderot.fr. [194.254.61.42]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e42bsm62855355e9.30.2024.07.19.11.38.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 11:38:27 -0700 (PDT) From: Simon Tournier Date: Fri, 19 Jul 2024 20:38:08 +0200 Message-ID: <29595ae1ec166885b3916f9239986da5a7fdad58.1721411923.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/lint.scm (guix-lint)[show-package-checkers]: New procedure. (show-help, %options): Add 'dry-run' option. * doc/guix.texi: Document it. Change-Id: I8c96e376d52c0961ccf2ab39f1fc856c762b089d --- doc/guix.texi | 3 +++ guix/scripts/lint.scm | 54 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 5b77c84b4a..6043962038 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -15463,6 +15463,9 @@ Invoking guix lint List and describe all the available checkers that will be run on packages and exit. +@item --dry-run +Do not run the checkers. + @item --checkers @itemx -c Only enable the checkers specified in a comma-separated list using the diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index ee3de51fb1..10abb05cf0 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -100,6 +100,8 @@ (define (show-help) (display (G_ "Usage: guix lint [OPTION]... [PACKAGE]... Run a set of checkers on the specified package; if none is specified, run the checkers on all packages.\n")) + (display (G_ " + --dry-run do not run checkers ")) (display (G_ " -c, --checkers=CHECKER1,CHECKER2... only run the specified checkers")) @@ -154,6 +156,9 @@ (define %options (option '(#\n "no-network") #f #f (lambda (opt name arg result) (alist-cons 'no-network? #t result))) + (option '("dry-run") #f #f + (lambda (opt name arg result) + (alist-cons 'dry-run? #t result))) (find (lambda (option) (member "load-path" (option-names option))) %standard-build-options) @@ -218,14 +223,55 @@ (define-command (guix-lint . args) (proc store)) (proc #f))) + (define (show-package-checkers package checkers) + (let* ((name (package-name package)) + (version (package-version package)) + (loc (package-location package)) + (number-checkers (length checkers)) + (number-all-checkers (length %all-checkers))) + (cond + ((= number-all-checkers number-checkers) + (info loc (G_ "~a@~a: all the ~d checkers would run.~%") + name version + number-all-checkers)) + ((= 0 number-checkers) + (info loc (G_ "~a@~a: none of ~d checkers would run~%") + name version + number-all-checkers)) + (else + (let* ((excluded-checkers (lset-difference eq? %all-checkers checkers)) + (number-excluded-checkers (length excluded-checkers)) + (number-difference (- number-all-checkers number-excluded-checkers)) + (sorter (lambda (list-checkers) + (sort (map (compose symbol->string lint-checker-name) + list-checkers) + string X-Patchwork-Id: 29384 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8B20E27BBE2; Fri, 19 Jul 2024 19:40:39 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 82F1D27BBE2 for ; Fri, 19 Jul 2024 19:40:38 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUsWX-0000Px-PQ; Fri, 19 Jul 2024 14:40:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sUsWX-0000NN-5N for guix-patches@gnu.org; Fri, 19 Jul 2024 14:40:09 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUsWW-00034d-Sc; Fri, 19 Jul 2024 14:40:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sUsWR-0006cx-Ao; Fri, 19 Jul 2024 14:40:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71697] [PATCH v5 2/3] scripts: lint: Honor package property to exclude checkers. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, pelzflorian@pelzflorian.de, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 19 Jul 2024 18:40:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier , Ludovic =?utf-8?q?Court=C3=A8?= =?utf-8?q?s?= Cc: Josselin Poiret , Maxim Cournoyer , Mathieu Othacehe , Tobias Geerinckx-Rice , Florian Pelz , 71697@debbugs.gnu.org, Christopher Baines , Matthew Trzcinski , Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 71697-submit@debbugs.gnu.org id=B71697.172141437925415 (code B ref 71697); Fri, 19 Jul 2024 18:40:03 +0000 Received: (at 71697) by debbugs.gnu.org; 19 Jul 2024 18:39:39 +0000 Received: from localhost ([127.0.0.1]:50877 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsW3-0006bq-0r for submit@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:39 -0400 Received: from mail-wm1-f46.google.com ([209.85.128.46]:39352) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsVy-0006bC-Bl for 71697@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:36 -0400 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-4266eae16b0so1505295e9.1 for <71697@debbugs.gnu.org>; Fri, 19 Jul 2024 11:39:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721414309; x=1722019109; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DnwR4aw+B4O3QRCbMN1mIc1jwcR0tVP0YivcSBsFQbg=; b=nFyud5hEMTmpdypFO50bM6YV50GR+A/QwyRvXnRCjWt5t9hRXxAvXI3uhKH8m5WZfE C1375gl1nk9rbSl4v9g82anrrlTH2nUvOIMTVDo+QHB4RImx/MhkyjEBfuueX1mmf/PC Jt5eMxWycBywvQDShT2m31hum5JaZR9Kg/T0+RUQEFUaJLmcyuzWxv5cuzpyAP3dHgcK xLyu4BrG+JnUueGRgIWSW1ORoEftXEcXYcw0EuabzoQqJCuidz+3yhp3lWwKmukgpj5V CErpK8U8lHJY69MJhDNk5YkrQ9BRr1+IA06V/hcVkvOZNpZroTPQR38dz8KVIXs2ltfc SGKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721414309; x=1722019109; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DnwR4aw+B4O3QRCbMN1mIc1jwcR0tVP0YivcSBsFQbg=; b=e3CztJuKsB7zFFQkhKwYUSQPOwcLoDaHRFMkITm0IDJBa5dJPIsKPVrwmtflQTIPQT 5OwcncTUqEgalf6N5PE9fbDfcmNmUPOb9LHLusqj57modYFnIvt5ytFkHL5Lu8GjU3wd JdPtGT73si7QvmZAvPybh0qCYcqKc3PTzv80E8v8GrBVHNzhGJSj09EB/P5SHOSUVpqu WOhDVEmhnaguT6rTk8lfksXadO1gK1Q3Pvn6mfnWP3mOLjq1ZGIfiH+UZBa6l1LVlcLA g6PB6Al3mKT2dev10fVQkego2SPEO2hRppfyHJa0K7xSvd6ZUkEjA3rfNdC164VWFJYU wN0w== X-Forwarded-Encrypted: i=1; AJvYcCUA4VzS1aZ2H/7Aa3//eYri5839J88z777mcQ7vvLJhbD1J3D5iSi1OWqbz16C4u1vTkLHe/L0Wz8eixCtfs4mNsYYwVTk= X-Gm-Message-State: AOJu0YzBOoVyvmGjVxpDjynDFnjUvQ2uWmD/kdPXsPcyc72V9aqSctyW 88ahfxHr0hDlPOD1m/1SeCon7StXx7e7f+tfy9O+mEH4thOOb/cZ X-Google-Smtp-Source: AGHT+IHd/9s1XJ4fXnkWQRXwDJHUzQ9C2v0J54RyMuUlJs0Cv09TuSy3E1AVs4gE5VGbsua+gm55sQ== X-Received: by 2002:a05:600c:310b:b0:426:6ecc:e5c4 with SMTP id 5b1f17b1804b1-427daa713abmr1266945e9.4.1721414309025; Fri, 19 Jul 2024 11:38:29 -0700 (PDT) Received: from lili.univ-paris-diderot.fr (roam-nat-fw-prg-194-254-61-42.net.univ-paris-diderot.fr. [194.254.61.42]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e42bsm62855355e9.30.2024.07.19.11.38.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 11:38:28 -0700 (PDT) From: Simon Tournier Date: Fri, 19 Jul 2024 20:38:09 +0200 Message-ID: <949e5c123cdba0cfc336f65e36438813cbfd6107.1721411923.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/lint.scm (exclude-package-checkers): New procedure, remove the checker if the package is marked. (run-checkers, guix-lint): Use it. * doc/guix.texi: Document 'lint-excluded-checkers' package property. Change-Id: Idf8e5c67102a1701ebd917bbc6212cfeb6ea2054 --- doc/guix.texi | 16 +++++++++++++++- guix/scripts/lint.scm | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 6043962038..0558532077 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Alex Griffin@* Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le Vaillant@* Copyright @copyright{} 2020 Liliana Marie Prikler@* -Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@* +Copyright @copyright{} 2019, 2020, 2021, 2022, 2023, 2024 Simon Tournier@* Copyright @copyright{} 2020 Wiktor Żelazny@* Copyright @copyright{} 2020 Damien Cassou@* Copyright @copyright{} 2020 Jakub Kądziołka@* @@ -15448,6 +15448,20 @@ Invoking guix lint to the new style. @end table +When developing a package, sometimes it is not desired to run the same +checker each time @command{guix lint} is invoked---e.g., because the +checker takes time or to avoid to send again and again the same request +for archiving. Instead of excluding the checker at the command-line via +the option @code{--exclude}, the package might be marked to skip the +checker by honoring the property in package definition, e.g., + +@lisp +(package + (name "python-scikit-learn") + ;; @dots{} + (properties '((lint-excluded-checkers . (archival home-page))))) +@end lisp + The general syntax is: @example diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 10abb05cf0..2df0cba948 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -9,7 +9,7 @@ ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; Copyright © 2017, 2018 Efraim Flashner ;;; Copyright © 2018, 2019 Arun Isaac -;;; Copyright © 2019, 2020 Simon Tournier +;;; Copyright © 2019, 2020, 2024 Simon Tournier ;;; Copyright © 2020 Brice Waegeneire ;;; ;;; This file is part of GNU Guix. @@ -59,6 +59,15 @@ (define (emit-warnings warnings) name version message)))) warnings)) +(define (exclude-package-checkers package checkers) + "Filter the CHECKERS list using PACKAGE properties field." + (let* ((properties (package-properties package)) + (excluded-checkers (or (assq-ref properties 'lint-excluded-checkers) + '()))) + (remove (lambda (checker) + (member (lint-checker-name checker) excluded-checkers)) + checkers))) + (define* (run-checkers package checkers #:key store) "Run the given CHECKERS on PACKAGE." (let ((tty? (isatty? (current-error-port)))) @@ -72,7 +81,8 @@ (define* (run-checkers package checkers #:key store) (if (lint-checker-requires-store? checker) ((lint-checker-check checker) package #:store store) ((lint-checker-check checker) package)))) - checkers) + (exclude-package-checkers + package checkers)) (when tty? (format (current-error-port) "\x1b[K") (force-output (current-error-port))))) @@ -227,6 +237,8 @@ (define-command (guix-lint . args) (let* ((name (package-name package)) (version (package-version package)) (loc (package-location package)) + (checkers (exclude-package-checkers + package checkers)) (number-checkers (length checkers)) (number-all-checkers (length %all-checkers))) (cond From patchwork Fri Jul 19 18:38:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 29385 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 95A3527BBE2; Fri, 19 Jul 2024 19:40:40 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 7F4B727BBEA for ; Fri, 19 Jul 2024 19:40:39 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sUsWW-0000J8-A6; Fri, 19 Jul 2024 14:40:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sUsWU-00009b-Bq for guix-patches@gnu.org; Fri, 19 Jul 2024 14:40:06 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sUsWU-00033m-2I; Fri, 19 Jul 2024 14:40:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sUsWQ-0006cn-SN; Fri, 19 Jul 2024 14:40:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71697] [PATCH v5 3/3] scripts: lint: Add hint for checker typo. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 19 Jul 2024 18:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier , Ludovic =?utf-8?q?Court=C3=A8?= =?utf-8?q?s?= Cc: Josselin Poiret , Maxim Cournoyer , Mathieu Othacehe , Tobias Geerinckx-Rice , Florian Pelz , 71697@debbugs.gnu.org, Christopher Baines , Matthew Trzcinski , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 71697-submit@debbugs.gnu.org id=B71697.172141437925408 (code B ref 71697); Fri, 19 Jul 2024 18:40:02 +0000 Received: (at 71697) by debbugs.gnu.org; 19 Jul 2024 18:39:39 +0000 Received: from localhost ([127.0.0.1]:50875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsW2-0006bk-Le for submit@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:38 -0400 Received: from mail-wr1-f48.google.com ([209.85.221.48]:39107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sUsVz-0006bE-7t for 71697@debbugs.gnu.org; Fri, 19 Jul 2024 14:39:36 -0400 Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3684b48d586so67719f8f.0 for <71697@debbugs.gnu.org>; Fri, 19 Jul 2024 11:39:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721414310; x=1722019110; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zTDjRDdr8A16OLDQD8FIYmtTvr5iPcjSisJdEnu8PSY=; b=X7UgqvusPguE1MK3uqtORXNuVu/YlEiRpt/EVsL2hCvtP4wG2GiPIKnQqGIGGafLZ0 7vYwm7WpORNmovXNuV8dSSJe/t50nllVKE2hVnxEb1UOhuzJymVpBIGqKtJVpjiV7/10 k5qXg1OhCiIed47tDJ3C3uZVFxyweb+vBtzGdKr6FGIJueCj4xIB65NYc2jFHGfZR6OP qDXfXr+48aW1exknwnRU3GpX5ZKU4FDe8COnQkFkFy1qFdfAMtM6z6OuDKXA6uqAboPS mj/KrEnbYKxSEPMLQ0xqfsANnccpuoh5ZPqwoJ8B7ncPHUQuGjLVfzh0UGQWAKF3j6Zl ApTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721414310; x=1722019110; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zTDjRDdr8A16OLDQD8FIYmtTvr5iPcjSisJdEnu8PSY=; b=ZalL7Z9qhoXIZcE0BbzaHFKdguvbhiIuslxl4OZfd/SgF1Xe/52NAk2KNiEyiS4Awi e+L2WLMZ7oCiJbjesdkpnMzlm48NAkd/BbQpD9AMqsit81irAs8MaDZ+SrsjWFW3apus wPRYAob6b0ojgXXKVrjF9DtkCqhrKHtL6HR2cIjZXLm5Dg6G5SXhIZsObKYRPhsJMOGA TvcyUfES2aWRh2Ta1VkYy+WzwkmRY/sCE5N0kyGsaImKnGjjklxpFat4ofb+l20lDLXy GXm+jNDekJcQSqx8dI5GgjsU7IVADF4OMiXRa/JCYpmdP4umsgWboEJWaV6hPWJTBxKm 64Fg== X-Forwarded-Encrypted: i=1; AJvYcCVVSMsGdayqGfuEH3Bc7C+RlcDyl9OFrpN5prNie1/z5/KpU91SouQ1kcc1kpnpcbvPbiOINauWrdJZBC6p1o9Vqt/SLso= X-Gm-Message-State: AOJu0YwnibfriDlARv3QN5KUYWoz3dQYmeVNB4hzbN8TZVD5Tk6bS6BA udWXLBQjR4BxWT4YkRFTD7okfxH3oY76lk9DhjxrV1zEc2Vrj/e0 X-Google-Smtp-Source: AGHT+IH2FioO+aYfrtGVpv+gH+0OEMfkcWVbjbReyaqwDODtZPtC705leMPNz5ZNEj9GyHdSw0DFmQ== X-Received: by 2002:a05:600c:4f42:b0:426:6f48:415e with SMTP id 5b1f17b1804b1-427daa27a99mr1399475e9.1.1721414310193; Fri, 19 Jul 2024 11:38:30 -0700 (PDT) Received: from lili.univ-paris-diderot.fr (roam-nat-fw-prg-194-254-61-42.net.univ-paris-diderot.fr. [194.254.61.42]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427d2a8e42bsm62855355e9.30.2024.07.19.11.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jul 2024 11:38:29 -0700 (PDT) From: Simon Tournier Date: Fri, 19 Jul 2024 20:38:10 +0200 Message-ID: <155dbefb7074dd3c77a1642b2aa6e18bb4e9df7b.1721411923.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/lint.scm (option-checker): Add hint for checker typo. Change-Id: I432c5b0570d2f413b59c2296666f3a4e5fb8c64c --- guix/scripts/lint.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm index 2df0cba948..f4aa394686 100644 --- a/guix/scripts/lint.scm +++ b/guix/scripts/lint.scm @@ -31,6 +31,7 @@ (define-module (guix scripts lint) #:use-module (guix packages) #:use-module (guix lint) #:use-module (guix ui) + #:use-module ((guix utils) #:select (string-closest)) #:use-module (guix store) #:use-module (guix scripts) #:use-module (guix scripts build) @@ -147,7 +148,15 @@ (define (option-checker short-long) ((short long) long))))) (for-each (lambda (c) (unless (memq c checker-names) - (leave (G_ "~a: invalid checker~%") c))) + (let* ((name (symbol->string c)) + (checkers (map symbol->string checker-names)) + (hint (string-closest name checkers + #:threshold 3))) + (report-error (G_ "~a: invalid checker~%") name) + (when hint + (display-hint + (format #f (G_ "Did you mean @code{~a}?~%") hint))) + (exit 1)))) names) (alist-cons option-name (filter (lambda (checker)