diff mbox series

[bug#71697,v4,1/2] scripts: lint: Add 'dry-run' option.

Message ID 87a5ifklr5.fsf@gmail.com
State New
Headers show
Series [bug#71697,v4,1/2] scripts: lint: Add 'dry-run' option. | expand

Commit Message

Simon Tournier July 18, 2024, 11 a.m. UTC
Hi,

On Thu, 18 Jul 2024 at 11:19, Ludovic Courtès <ludo@gnu.org> wrote:

>                                          That said, I find ‘--dry-run’
> in this case not so useful because it would just print the same thing on
> and on for each and every package.

No, it’s different; or can be.  For instance, ’archival’ is listed for
one but not for the other.

--8<---------------cut here---------------start------------->8---
$ git diff

$ ./pre-inst-env guix lint hello python-scikit-learn --dry-run
hello@2.12.1 checked by archival compiler-for-target cve derivation description formatting github-url gnu-description haskell-stackage home-page input-labels inputs-should-be-native inputs-should-not-be-input license mirror-url name optional-tests patch-file-names patch-headers profile-collisions refresh source source-file-name source-unstable-tarball synopsis tests-true wrapper-inputs.
python-scikit-learn@1.4.2 checked by compiler-for-target cve derivation description formatting github-url gnu-description haskell-stackage home-page input-labels inputs-should-be-native inputs-should-not-be-input license mirror-url optional-tests patch-file-names patch-headers profile-collisions refresh source source-file-name source-unstable-tarball tests-true wrapper-inputs.
--8<---------------cut here---------------end--------------->8---

Well, the aim is to know which checker applies to which package just
before they are indeed applied.

Initially, I thought something like:

--8<---------------cut here---------------start------------->8---
modified   guix/scripts/lint.scm
@@ -223,6 +223,11 @@ (define-command (guix-lint . args)
     (when (assoc-ref opts 'list?)
       (list-checkers-and-exit checkers))
 
+    (when (assoc-ref opts 'dry-run?)
+      (if (null? args)
+          (show-checkers-and-exit)
+          (show-packages-checkers-and-exit args checkers)))
+
     (with-error-handling
       (let ((any-lint-checker-requires-store?
              (any lint-checker-requires-store? checkers)))
--8<---------------cut here---------------end--------------->8---

where ’show-checkers-and-exit’ takes into account only option ’-c’ or
option ’-x’, displaying something as: “The following checkers would run
for all <number of packages> packages:” and the list of checkers.

And ’show-packages-checkers-and-exit’ would display:

--8<---------------cut here---------------start------------->8---
The following checkers would run for packages: <"short“ "list of package@X.Y>

 + list of all common checkers

The following checkers would be excluded for packages: <"short“ "list of package@X.Y>

 + list of excluded checkers
--8<---------------cut here---------------end--------------->8---

But then I concluded that would not be a true dry-run. ;-)


For the comments, thanks!  That’s better.

Cheers,
simon
diff mbox series

Patch

diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm
index 3680cab044..5a22f7a865 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