From: Vagrant Cascadian <vagrant@debian.org>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: guix lint false positives and RFC patch
Date: Fri, 04 Nov 2022 15:24:38 -0700 [thread overview]
Message-ID: <87leoqcq8p.fsf@contorta> (raw)
In-Reply-To: <877d0beh4i.fsf@contorta>
[-- Attachment #1.1: Type: text/plain, Size: 1695 bytes --]
On 2022-11-03, Vagrant Cascadian wrote:
> 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!
Well, ugly is what I have... Found two packages affected by @acronym.
Also realized that it should leave the {} in the length-matching, as
they are typically replaced by other characters when rendered.
> That said, I think this resolves 52 false positives with guix lint (~10%
> of the 536 synopsis/description issues currently).
Think with this applied there are 54 false positives fixed.
live well,
vagrant
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-lint-Exclude-some-symbols-from-various-checks.patch --]
[-- Type: text/x-diff, Size: 1647 bytes --]
From bfa13fdd3616839883e50efbbc05fb132610ce67 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Wed, 2 Nov 2022 19:56:12 -0700
Subject: [PATCH 01/12] 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" and "@acronym".
---
guix/lint.scm | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/guix/lint.scm b/guix/lint.scm
index 8e3976171f..76b17b297d 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,10 @@ (define check-start-article
'()))))
(define (check-synopsis-length synopsis)
- (if (>= (string-length synopsis) 80)
+ (if (>= (string-length (string-replace-substring
+ (string-replace-substring synopsis "@acronym" "")
+ "@code" ""))
+ 80)
(list
(make-warning package
(G_ "synopsis should be less than 80 characters long")
--
2.35.1
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
next prev parent reply other threads:[~2022-11-04 22:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 3:29 guix lint false positives and RFC patch Vagrant Cascadian
2022-11-03 15:20 ` Ludovic Courtès
2022-11-03 23:46 ` Vagrant Cascadian
2022-11-04 22:24 ` Vagrant Cascadian [this message]
2022-11-05 17:52 ` Ludovic Courtès
2022-11-13 1:54 ` Vagrant Cascadian
2022-11-17 15:03 ` Ludovic Courtès
2023-01-27 17:42 ` Simon Tournier
2023-01-28 21:07 ` Vagrant Cascadian
2023-01-28 21:24 ` Maxime Devos
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87leoqcq8p.fsf@contorta \
--to=vagrant@debian.org \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).