GNU bug report logs -
#47804
[PATCH] lint: Warn about underscores in package names.
Previous Next
Reported by: Xinglu Chen <public <at> yoctocell.xyz>
Date: Thu, 15 Apr 2021 16:02:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #8 received at 47804 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Thu, 2021-04-15 at 18:00 +0200, Xinglu Chen wrote:
> As per section '16.4.2 Package Naming' in the manual, use hyphens
> instead of underscores in package names.
>
> * guix/lint.scm (check-name): Check whether the package name contains
> underscores.
> ---
> There was some discussion about this on guix-devel[1], but no consensus
> was reached. Should we whitelist certain names like “86_64” or something?
I dunno. Perhaps for now, we can accept that the 'check-name' linter is
sometimes overly strict, and punt the exceptions for later?
> [1]: https://yhetil.org/guix-devel/87v991vkpi.fsf <at> nckx
>
> guix/lint.scm | 23 +++++++++++++++--------
> 1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/guix/lint.scm b/guix/lint.scm
> index a7d6bbba4f..d5ad69475e 100644
> --- a/guix/lint.scm
> +++ b/guix/lint.scm
> @@ -11,6 +11,7 @@
> ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac <at> systemreboot.net>
> ;;; Copyright © 2020 Chris Marusich <cmmarusich <at> gmail.com>
> ;;; Copyright © 2020 Timothy Sample <samplet <at> ngyro.com>
> +;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -173,14 +174,20 @@
> (define (check-name package)
> "Check whether PACKAGE's name matches our guidelines."
> (let ((name (package-name package)))
> - ;; Currently checks only whether the name is too short.
> - (if (and (<= (string-length name) 1)
> - (not (string=? name "r"))) ; common-sense exception
> - (list
> - (make-warning package
> - (G_ "name should be longer than a single character")
> - #:field 'name))
> - '())))
> + (cond
> + ;; Currently checks only whether the name is too short.
> + ((and (<= (string-length name) 1)
> + (not (string=? name "r"))) ; common-sense exception
> + (list
> + (make-warning package
> + (G_ "name should be longer than a single character")
> + #:field 'name)))
> + ((string-match "_" name)
> + (list
> + (make-warning package
> + (G_ "name should use hyphens instead of underscores")
> + #:field 'name)))
> + (else '()))))
I didn't test this, but that seems about right.
Ideally, you should add a corresponding test in tests/lint.scm
(IIRC, maybe the linter tests are elsewhere).
However, Guix is currently in the "string freeze", so this cannot yet be merged,
IIUC.
Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]
This bug report was last modified 4 years and 87 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.