unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* guix lint false positives and RFC patch
@ 2022-11-03  3:29 Vagrant Cascadian
  2022-11-03 15:20 ` Ludovic Courtès
  0 siblings, 1 reply; 10+ messages in thread
From: Vagrant Cascadian @ 2022-11-03  3:29 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 627 bytes --]

I've noticed a handful of false positives in guix lint checking
descriptions and synopsis, and tracked several down to the use of
@code{} and similar.

The attached patch partly addresses this, though could definitely be
written better (e.g. handling more cases, also stripping out the
relevent "}", etc.)

This fixes about 11 out of 544 overall guix lint issues with
descriptions and synopsis. Had expected it to fix more issues, but I
think stripping the "@code{" reveals issues in other checks that were
previously hidden.... maybe.

I will reiterate that this leaves a lot of room for improvement. :)

live well,
  vagrant

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-guix-lint-Exclude-code-from-various-checks.patch --]
[-- Type: text/x-diff, Size: 1530 bytes --]

From 209c97b91d02831d78fc0b032f3b83fd5e0b9cb1 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 "@code{" from various checks.

The visual representation of the relevent 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 "@code{".
  (check-synopsis-length): Exclude "@code{".
---
 guix/lint.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/guix/lint.scm b/guix/lint.scm
index 8e3976171f..4dc35218db 100644
--- 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{" "")))
 
 (define (starts-with-abbreviation? s)
   "Return #t if S starts with what looks like an abbreviation or acronym."
@@ -650,7 +651,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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-01-28 21:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).