all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Christopher Baines <mail@cbaines.net>
Cc: guix-devel@gnu.org
Subject: Re: Linting, and how to get the information in to the Guix Data Serivce
Date: Tue, 07 May 2019 23:16:45 +0200	[thread overview]
Message-ID: <874l662cea.fsf@gnu.org> (raw)
In-Reply-To: <87d0kvo0v9.fsf@cbaines.net> (Christopher Baines's message of "Mon, 06 May 2019 20:10:18 +0100")

Hello!

Christopher Baines <mail@cbaines.net> skribis:

> Christopher Baines <mail@cbaines.net> writes:
>
>> I've never worked with this part of Guix before, and some of it is quite
>> complex, so I've started by attempting to do the first bit, storing
>> warnings as data before outputting them. I've attached a patch.

Providing more structure sounds like a good idea to me (though in the
end it’s still just text; not sure if that’s good enough for what you
had in mind?).

From a UI viewpoint, it’s important that ‘guix lint’ prints warning as
they come, rather than eat CPU for some time and eventually spit out
everything at once.

> From cd16443893afdacf9f3e4d8256cc943a5928aed4 Mon Sep 17 00:00:00 2001
> From: Christopher Baines <mail@cbaines.net>
> Date: Mon, 6 May 2019 19:00:58 +0100
> Subject: [PATCH] scripts: lint: Handle warnings with a record type.
>
> Rather than emiting warnings directly to a port, have the checkers return the
> warning or warnings.
>
> This makes it easier to use the warnings in different ways, for example,
> loading the data in to a database, as you can work with the <lint-warning>
> records directly, rather than having to parse the output to determine the
> package and location.

[...]

> +(define-record-type* <lint-warning>
> +  lint-warning make-lint-warning
> +  lint-warning?
> +  (package  lint-warning-package)
> +  (message  lint-warning-message)
> +  (location lint-warning-field
> +            (default #f)))

It could be useful to have a ‘checker’ field linking to the checker that
produced the warning.

>    (define (check-not-empty description)
>      (when (string-null? description)
> -      (emit-warning package
> +      (make-warning package
>                      (G_ "description should not be empty")
> -                    'description)))
> +                    #:field 'description)))

This procedure returns either a warning or the unspecified value, which
is probably not intended?  I suppose a lot of the code is currently
written with ‘emit-warning’ in effect position, which will have to be
changed.

I suppose tests/lint.scm needs to be converted to the new API?

Thanks!

Ludo’.

  reply	other threads:[~2019-05-07 21:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 18:26 Linting, and how to get the information in to the Guix Data Serivce Christopher Baines
2019-05-06 19:10 ` Christopher Baines
2019-05-07 21:16   ` Ludovic Courtès [this message]
2019-05-10  7:02     ` Christopher Baines
2019-05-18 10:30       ` Christopher Baines

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=874l662cea.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=guix-devel@gnu.org \
    --cc=mail@cbaines.net \
    /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.