Subject: [bug#71697] [PATCH v5 0/3] Add dry-run to guix lint

From: Simon Tournier <[email-masked]>
Date: Fri, 19 Jul 2024 20:27:04 +0200

Hi,

Examples are probably better than many words. :-)

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix lint --dry-run
guix lint: error: too much information to display, did nothing and exit

$ ./pre-inst-env guix lint --dry-run hello
gnu/packages/base.scm:94:2: [email-masked]: all the 27 checkers would run.

$ ./pre-inst-env guix lint --dry-run hello -c derivation
gnu/packages/base.scm:94:2: [email-masked]: 1/27 checkers would run: derivation.

$ ./pre-inst-env guix lint --dry-run hello -n
gnu/packages/base.scm:94:2: [email-masked]: 18/27 checkers would run at the exclusion of: archival cve github-url gnu-description haskell-stackage home-page refresh source synopsis.

$ ./pre-inst-env guix lint --dry-run hello -c derivation -x derivation
gnu/packages/base.scm:94:2: [email-masked]: none of 27 checkers would run

$ # Using modified package with the new package properties
$ ./pre-inst-env guix lint --dry-run hello python-scikit-learn -x cve 
gnu/packages/base.scm:94:2: [email-masked]: 26/27 checkers would run at the exclusion of: cve.
gnu/packages/machine-learning.scm:1723:2: [email-masked]: 23/27 checkers would run at the exclusion of: archival cve name synopsis.
--8<---------------cut here---------------end--------------->8---

I think it addresses all the comments.  The idea is to display the most
relevant information, i.e., the message displays the shortest list of checkers
between the excluded ones and the others, because, IMHO, it eases to get what
would run.

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix lint --dry-run hello -c name,tests-true,compiler-for-target,description,inputs-should-be-native,inputs-should-not-be-input,input-labels,wrapper-inputs,license,optional-tests,mirror-url,source-file-name,source-unstable-tarball,profile-collisions,patch-file-names,patch-headers,formatting,synopsis,gnu-description,home-page,source,github-url,cve,refresh,archival,haskell-stackage
gnu/packages/base.scm:94:2: [email-masked]: 26/27 checkers would run at the exclusion of: derivation.
--8<---------------cut here---------------end--------------->8---

Well, since I did some typo when testing, the last patch of the series is
included for the same price. ;-)

--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix lint -c dervation
guix lint: error: dervation: invalid checker
hint: Did you mean `derivation'?
--8<---------------cut here---------------end--------------->8---

WDYT?

Cheers,
simon

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 34dc5c8d26..cbebc6494e 100644
--- a/gnu/packages/machine-learning.scm
+++ b/gnu/packages/machine-learning.scm
@@ -1775,6 +1775,7 @@ (define-public python-scikit-learn
            python-pytest-xdist))
     (propagated-inputs
      (list python-numpy python-threadpoolctl python-scipy python-joblib))
+    (properties '((lint-excluded-checkers . (archival name synopsis))))
     (home-page "https://scikit-learn.org/")
     (synopsis "Machine Learning in Python")
     (description
--8<---------------cut here---------------end--------------->8---

Simon Tournier (3):
  scripts: lint: Add 'dry-run' option.
  scripts: lint: Honor package property to exclude checkers.
  scripts: lint: Add hint for checker typo.

 doc/guix.texi         | 19 +++++++++-
 guix/scripts/lint.scm | 81 +++++++++++++++++++++++++++++++++++++++----
 2 files changed, 92 insertions(+), 8 deletions(-)

base-commit: 9724e61cda80e4c59a2eb419a453887ecc551b9a
-- 
2.41.0