GNU bug report logs - #71697
[PATCH] guix: lint: Honor 'no-archival?' package property.

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Fri, 21 Jun 2024 18:13:01 UTC

Severity: normal

Tags: patch

Full log


Message #92 received at 71697 <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: Simon Tournier <zimon.toutoune <at> gmail.com>,
 Ludovic Courtès <ludo <at> gnu.org>
Cc: Josselin Poiret <dev <at> jpoiret.xyz>,
 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>,
 Mathieu Othacehe <othacehe <at> gnu.org>, Tobias Geerinckx-Rice <me <at> tobias.gr>,
 Florian Pelz <pelzflorian <at> pelzflorian.de>, 71697 <at> debbugs.gnu.org,
 Christopher Baines <guix <at> cbaines.net>, Matthew Trzcinski <matt <at> excalamus.com>
Subject: [PATCH v5 3/3] scripts: lint: Add hint for checker typo.
Date: Fri, 19 Jul 2024 20:38:10 +0200
* 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)
-- 
2.41.0





This bug report was last modified 1 year and 44 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.