[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guix lint false positives and RFC patch
From: |
Vagrant Cascadian |
Subject: |
Re: guix lint false positives and RFC patch |
Date: |
Thu, 03 Nov 2022 16:46:21 -0700 |
On 2022-11-03, Ludovic Courtès wrote:
> Vagrant Cascadian <vagrant@debian.org> skribis:
>
>> --- a/guix/lint.scm
>> +++ b/guix/lint.scm
>> @@ -313,7 +313,8 @@ (define (tests-explicitly-enabled?)
>> '()))
>>
>> (define (properly-starts-sentence? s)
>> - (string-match "^[(\"'`[:upper:][:digit:]]" s))
>> + (string-match "^[(\"'`[:upper:][:digit:]]"
>> + (string-replace-substring s "@code{" "")))
>
> An identifier in @code or file name in @file may legitimately start with
> a lower-case letter so I don’t think we should try to prevent that.
>
> However, maybe we could change the regexp above to something that
> accepts @ or some other non-letter character at the start?
Great suggestion, as it is simpler, easier to read, and actually covers
more false positives! Updated patch attached!
I think there was only one case fixed by the @code{} check for the
synopsis length check, and I don't see any obvious other @*{} checks
that would currently improve anything, though it would be ideal to make
it more future-proof just in case... though I think my attempt at that
would be awfully ugly, help from others would be welcome!
That said, I think this resolves 52 false positives with guix lint (~10%
of the 536 synopsis/description issues currently).
live well,
vagrant
From d4ddd4a90f18666352b07a4ebe0ed6b79c74f21e Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Wed, 2 Nov 2022 19:56:12 -0700
Subject: [PATCH] guix: lint: Exclude some "@" symbols from various checks.
The visual representation of "@code{}" or similar in the description and
synopsis do not include the string, so exclude it from checks to avoid false
positives.
FIXME handle @command, @file, @acronym, etc.
* guix/linx.scm (properly-starts-sentence): Exclude leading "@".
(check-synopsis-length): Exclude "@code{".
---
guix/lint.scm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/guix/lint.scm b/guix/lint.scm
index 8e3976171f..26d8f59a2c 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -313,7 +313,7 @@ (define (tests-explicitly-enabled?)
'()))
(define (properly-starts-sentence? s)
- (string-match "^[(\"'`[:upper:][:digit:]]" s))
+ (string-match "^[@(\"'`[:upper:][:digit:]]" s))
(define (starts-with-abbreviation? s)
"Return #t if S starts with what looks like an abbreviation or acronym."
@@ -650,7 +650,7 @@ (define check-start-article
'()))))
(define (check-synopsis-length synopsis)
- (if (>= (string-length synopsis) 80)
+ (if (>= (string-length (string-replace-substring synopsis "@code{" "")) 80)
(list
(make-warning package
(G_ "synopsis should be less than 80 characters long")
--
2.35.1
signature.asc
Description: PGP signature