From: "Ludovic Courtès" <ludo@gnu.org>
To: Herman Rimm <herman@rimm.ee>
Cc: Josselin Poiret <dev@jpoiret.xyz>,
Simon Tournier <zimon.toutoune@gmail.com>,
Mathieu Othacehe <othacehe@gnu.org>,
Tobias Geerinckx-Rice <me@tobias.gr>,
74979@debbugs.gnu.org, Christopher Baines <guix@cbaines.net>
Subject: [bug#74979] [PATCH 0/4] scripts: style: Sort more kinds of package
Date: Mon, 23 Dec 2024 18:28:39 +0100 [thread overview]
Message-ID: <87ttau8g1k.fsf@gnu.org> (raw)
In-Reply-To: <cover.1734636205.git.herman@rimm.ee> (Herman Rimm's message of "Thu, 19 Dec 2024 20:31:12 +0100")
Hi Herman,
Herman Rimm <herman@rimm.ee> skribis:
> The warnings added in [PATCH 4/4] are emitted multiple times. How
> should I prevent that? Or should I put them behind a --verbose option?
Not sure, do you have an example on how to trigger it?
> +++ b/guix/scripts/style.scm
> @@ -508,9 +508,15 @@ (define (order-packages lst)
> (((or 'package 'package/inherit) fields ...)
> (let ((name (and=> (assoc-ref fields 'name) first))
> (version (and=> (assoc-ref fields 'version) first)))
> + (if (and name version)
> + (unless (and (string? name) (string? version))
> + (warning (G_ "non-string name/version for ~a~%") pkg))
> + (warning (G_ "package fields not found for ~a~%") pkg))
> (values name version)))
> - (_ (and (values #f #f)))))
> - (_ (and (values #f #f)))))
> + (_ (and (warning (G_ "package record missing for ~a~%") pkg)
> + (values #f #f)))))
> + (_ (and (info (G_ "not sorting top-level S-exp.: ~a~%") pkg)
> + (values #f #f)))))
You shouldn’t rely on the return value of ‘info’, ‘warning’, etc.:
they’re not specified (that’s generally the case for procedures called
for side effects only).
So I’d recommend:
(begin
(info …)
(values #f #f))
(You don’t even need ‘begin’ in this context.)
The other patches LGTM, though perhaps ‘tests/guix-style.sh’ could be
augmented a bit to cover the new cases?
Thanks,
Ludo’.
next prev parent reply other threads:[~2024-12-23 17:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 19:31 [bug#74979] [PATCH 0/4] scripts: style: Sort more kinds of package Herman Rimm via Guix-patches via
2024-12-19 19:33 ` [bug#74979] [PATCH 1/4] scripts: style: Refactor order-packages Herman Rimm via Guix-patches via
2024-12-19 19:33 ` [bug#74979] [PATCH 2/4] scripts: style: Sort more kinds of package definitions Herman Rimm via Guix-patches via
2024-12-19 19:33 ` [bug#74979] [PATCH 3/4] scripts: style: Only sort packages with string literal name Herman Rimm via Guix-patches via
2024-12-19 19:33 ` [bug#74979] [PATCH 4/4] scripts: style: Warn about unmatched package definitions Herman Rimm via Guix-patches via
2024-12-23 17:28 ` Ludovic Courtès [this message]
2024-12-24 10:42 ` [bug#74979] [PATCH 0/4] scripts: style: Sort more kinds of package Herman Rimm via Guix-patches via
2024-12-24 11:28 ` Herman Rimm via Guix-patches via
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttau8g1k.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=74979@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=herman@rimm.ee \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=zimon.toutoune@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.