From: Gabriel Wicki <gabriel@erlikon.ch>
To: 74459@debbugs.gnu.org
Subject: [bug#74459] [PATCH v2 3/7] guix: lint: Allow texinfo markup at beginning of description.
Date: Mon, 2 Dec 2024 23:36:44 +0100 [thread overview]
Message-ID: <kfgenr4mjqo3vsdg6rpuzrhwyrfzdnkuvydnjkwyv4afrvzzkx@k3weeqoimq7c> (raw)
In-Reply-To: <po7r7oijub2gkqzxwkgm76cprdnm3yvy4lsnwjbl4tven5zkxy@riur6kp7ldps>
* guix/lint.scm(starts-with-texinfo-markup?): New function.
(check-description-style)[check-proper-start]: Add condition.
* tests/lint.scm: Add test case.
Change-Id: I674988882265d9e2041d48dba0f9627cd68bf292
---
guix/lint.scm | 8 +++++++-
tests/lint.scm | 5 +++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/guix/lint.scm b/guix/lint.scm
index 63d101ebf9..d6d48ad27c 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -370,6 +370,9 @@ (define (check-compiler-for-target package)
(define (properly-starts-sentence? s)
(string-match "^[(\"'`[:upper:][:digit:]]" s))
+(define (starts-with-texinfo-markup? s)
+ (string-match "^@(acronym|dfn|code|command|emph|file|quotation|samp|uref|url)\\{.*?\\}" s))
+
(define (starts-with-abbreviation? s)
"Return #t if S starts with what looks like an abbreviation or acronym."
(string-match "^[A-Z][A-Z0-9]+\\>" s))
@@ -447,6 +450,7 @@ (define (check-description-style package)
'pre "-" 'post)))
(if (or (string-null? description)
(properly-starts-sentence? description)
+ (starts-with-texinfo-markup? description)
(string-prefix-ci? first-word (package-name package))
(string-suffix-ci? first-word (package-name package)))
'()
@@ -513,7 +517,9 @@ (define (check-description-style package)
(match (check-texinfo-markup description)
((and warning (? lint-warning?)) (list warning))
(plain-description
- (check-proper-start plain-description))))
+ (if (string-prefix? "@" description)
+ '()
+ (check-proper-start plain-description)))))
(list
(make-warning package
(G_ "invalid description: ~s")
diff --git a/tests/lint.scm b/tests/lint.scm
index 9297bfbaac..df7042c470 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -121,6 +121,11 @@ (define (warning-contains? str warnings)
(description "bad description."))))
(check-description-style pkg))))
+(test-equal "description: may start with texinfo markup"
+ '()
+ (check-description-style
+ (dummy-package "x" (description "@emph{Maxwell Equations of Software}"))))
+
(test-equal "description: may start with a digit"
'()
(let ((pkg (dummy-package "x"
--
2.46.0
next prev parent reply other threads:[~2024-12-02 22:37 UTC|newest]
Thread overview: 19+ 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
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
2024-12-02 22:34 ` [bug#74459] [PATCH v2 1/7] guix: lint: Fix indentation Gabriel Wicki
2024-12-02 22:46 ` [bug#74459] comments Gabriel Wicki
2024-12-02 22:35 ` [bug#74459] [PATCH v2 2/7] guix: lint: Refine description start check logic Gabriel Wicki
2024-12-02 22:36 ` Gabriel Wicki [this message]
2024-12-02 22:37 ` [bug#74459] [PATCH v2 4/7] guix: lint: Allow texinfo markup at beginning of synopsis Gabriel Wicki
2024-12-02 22:38 ` [bug#74459] [PATCH v2 5/7] guix: lint: Prevent false positives in description typo check Gabriel Wicki
2024-12-02 22:39 ` [bug#74459] [PATCH v2 6/7] guix: lint: Ignore initials from double space check Gabriel Wicki
2024-12-02 22:40 ` [bug#74459] [PATCH v2 7/7] guix: lint: More abbreviations Gabriel Wicki
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=kfgenr4mjqo3vsdg6rpuzrhwyrfzdnkuvydnjkwyv4afrvzzkx@k3weeqoimq7c \
--to=gabriel@erlikon.ch \
--cc=74459@debbugs.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).