all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: Gabriel Wicki <gabriel@erlikon.ch>
Cc: 74459@debbugs.gnu.org
Subject: [bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic.
Date: Fri, 29 Nov 2024 14:54:00 +0100	[thread overview]
Message-ID: <874j3q16yv.fsf@gnu.org> (raw)
In-Reply-To: <virti5p4tcdrfczmkguwlfok6biaxqmu3q2dt737worygor2la@frziltjtdpkc> (Gabriel Wicki's message of "Thu, 21 Nov 2024 13:44:52 +0100")

Hi,

Gabriel Wicki <gabriel@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’.




  reply	other threads:[~2024-11-29 13:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-21 12:40 [bug#74459] [PATCH 0/8] Linter improvements (eliminate false positives)^[ Gabriel Wicki
2024-11-21 12:43 ` [bug#74459] [PATCH 1/8] guix: lint: Fix indentation Gabriel Wicki
2024-11-21 12:44 ` [bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic Gabriel Wicki
2024-11-29 13:54   ` Ludovic Courtès [this message]
2024-11-21 12:45 ` [bug#74459] [PATCH 3/8] guix: lint: Allow texinfo markup at beginning of description Gabriel Wicki
2024-11-21 12:46 ` [bug#74459] [PATCH 4/8] guix: lint: Allow texinfo markup at beginning of synopsis Gabriel Wicki
2024-11-21 12:47 ` [bug#74459] [PATCH 5/8] guix: lint: Prevent false positives in description typo check Gabriel Wicki
2024-11-21 12:48 ` [bug#74459] [PATCH 6/8] guix: lint: Ignore initials from double space check Gabriel Wicki
2024-11-21 12:49 ` [bug#74459] [PATCH 7/8] guix: lint: More abbreviations Gabriel Wicki
2024-11-21 22:25 ` [bug#74459] comments Gabriel Wicki
2024-11-29 13:55   ` Ludovic Courtès

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=874j3q16yv.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=74459@debbugs.gnu.org \
    --cc=gabriel@erlikon.ch \
    /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.