[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic
From: |
Ludovic Courtès |
Subject: |
[bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic. |
Date: |
Fri, 29 Nov 2024 14:54:00 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
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’.
- [bug#74459] [PATCH 0/8] Linter improvements (eliminate false positives), Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 1/8] guix: lint: Fix indentation., Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 3/8] guix: lint: Allow texinfo markup at beginning of description., Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic., Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic.,
Ludovic Courtès <=
- [bug#74459] [PATCH 4/8] guix: lint: Allow texinfo markup at beginning of synopsis., Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 5/8] guix: lint: Prevent false positives in description typo check., Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 6/8] guix: lint: Ignore initials from double space check., Gabriel Wicki, 2024/11/21
- [bug#74459] [PATCH 7/8] guix: lint: More abbreviations., Gabriel Wicki, 2024/11/21
- [bug#74459] comments, Gabriel Wicki, 2024/11/21