From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: Re: Linting, and how to get the information in to the Guix Data Serivce Date: Tue, 07 May 2019 23:16:45 +0200 Message-ID: <874l662cea.fsf@gnu.org> References: <875zqnjv7h.fsf@cbaines.net> <87d0kvo0v9.fsf@cbaines.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([209.51.188.92]:43379) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hO7SD-0001op-Kl for guix-devel@gnu.org; Tue, 07 May 2019 17:16:50 -0400 In-Reply-To: <87d0kvo0v9.fsf@cbaines.net> (Christopher Baines's message of "Mon, 06 May 2019 20:10:18 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Christopher Baines Cc: guix-devel@gnu.org Hello! Christopher Baines skribis: > Christopher Baines 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=E2=80=99s still just text; not sure if that=E2=80=99s good enough fo= r what you had in mind?). >From a UI viewpoint, it=E2=80=99s important that =E2=80=98guix lint=E2=80= =99 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 > 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 > records directly, rather than having to parse the output to determine the > package and location. [...] > +(define-record-type* > + 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 =E2=80=98checker=E2=80=99 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 =E2=80=98emit-warning=E2=80=99 in effect position, which will = have to be changed. I suppose tests/lint.scm needs to be converted to the new API? Thanks! Ludo=E2=80=99.