GNU bug report logs - #74459
[PATCH 0/8] Linter improvements (eliminate false positives)

Previous Next

Package: guix-patches;

Reported by: Gabriel Wicki <gabriel <at> erlikon.ch>

Date: Thu, 21 Nov 2024 12:41:01 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 #34 received at 74459 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Gabriel Wicki <gabriel <at> erlikon.ch>
Cc: 74459 <at> debbugs.gnu.org
Subject: Re: [bug#74459] [PATCH 2/8] guix: lint: Refine description start
 check logic.
Date: Fri, 29 Nov 2024 14:54:00 +0100
Hi,

Gabriel Wicki <gabriel <at> erlikon.ch> skribis:

> Fix linter warnings for the following:
>
>  - packages that belong to some programming language or ecosystem,
>  e.g. python-foo or texlive-bar,
>  - packages whose names end in a version distinction, e.g. wlroots-0.16 and
>  - packages where the software's real name contains an underscore `_'
>  character where our package name replaced that with a hyphen `-',
>  e.g. wpa_supplicant and wpa-supplicant-minimal.
>
> * guix/lint.scm (check-description-style)[check-proper-start]: Add conditions.
> * tests/lint.scm: New tests.
>
> Change-Id: Ifc9f5cda04db59e460e287cd93afae89c7f17e3c

[...]

>    (define (check-proper-start description)
> -    (if (or (string-null? description)
> -            (properly-starts-sentence? description)
> -            (string-prefix-ci? (package-name package) description))
> -        '()
> -        (list
> -         (make-warning
> -          package
> -          (G_ "description should start with an upper-case letter or digit")
> -          #:field 'description))))
> +    (let* ((initial (car (string-split description #\space)))

In general we try to avoid ‘car’ and ‘cdr’:

  https://guix.gnu.org/manual/devel/en/html_node/Data-Types-and-Pattern-Matching.html

But also, instead of traversing all of ‘description’, perhaps you could
have something like (untested):

  (define (first-word str)
    (let* ((str (string-trim str))
           (length (or (and=> (string-index str #\space) 1+) (string-length str))))
      (string-take str length)))

Ludo’.




This bug report was last modified 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.