From: Maxime Devos <maximedevos@telenet.be>
To: Xinglu Chen <public@yoctocell.xyz>, 47804@debbugs.gnu.org
Subject: [bug#47804] [PATCH] lint: Warn about underscores in package names.
Date: Thu, 15 Apr 2021 18:19:53 +0200 [thread overview]
Message-ID: <e1a120c2fbd81850ec7a8281f6cc14cbdc0344fb.camel@telenet.be> (raw)
In-Reply-To: <dc3d1c690b40861eab4d623fb8bca88f4194e209.1618502119.git.public@yoctocell.xyz>
[-- Attachment #1: Type: text/plain, Size: 2591 bytes --]
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@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@systemreboot.net>
> ;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
> ;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
> +;;; Copyright © 2021 Xinglu Chen <public@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.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2021-04-15 16:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-15 16:00 [bug#47804] [PATCH] lint: Warn about underscores in package names Xinglu Chen
2021-04-15 16:19 ` Maxime Devos [this message]
2021-04-15 18:15 ` Xinglu Chen
2021-04-16 10:19 ` Maxime Devos
2021-04-15 18:31 ` [bug#47804] [PATCH v2] " Xinglu Chen
2021-04-16 20:54 ` bug#47804: [PATCH] " Ludovic Courtès
2021-04-16 21:42 ` [bug#47804] " Julien Lepiller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e1a120c2fbd81850ec7a8281f6cc14cbdc0344fb.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=47804@debbugs.gnu.org \
--cc=public@yoctocell.xyz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).