[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#71697] [PATCH v4 2/2] scripts: lint: Honor package property to excl
From: |
Simon Tournier |
Subject: |
[bug#71697] [PATCH v4 2/2] scripts: lint: Honor package property to exclude checkers. |
Date: |
Fri, 12 Jul 2024 19:22:13 +0200 |
* 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 | 17 ++++++++++++++---
2 files changed, 29 insertions(+), 4 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 1b13d6e17f..ca1864b459 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -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, 2020 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2019, 2020, 2024 Simon Tournier <zimon.toutoune@gmail.com>
;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
;;;
;;; 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)))))
@@ -228,7 +238,8 @@ (define-command (guix-lint . args)
(package-name package)
(package-version package)
(sort (map (compose symbol->string lint-checker-name)
- checkers)
+ (exclude-package-checkers
+ package checkers))
string<?)))
(call-maybe-with-store
--
2.41.0