From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id GAyvE842P2eLBAAAqHPOHw:P1 (envelope-from ) for ; Thu, 21 Nov 2024 13:34:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id GAyvE842P2eLBAAAqHPOHw (envelope-from ) for ; Thu, 21 Nov 2024 14:34:06 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=P3rDxq0H; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1732196046; a=rsa-sha256; cv=none; b=OlQl++i/pJ1/mZmWqK3oAeIe6NrhuQE4NZcq7JCZY9DeTuMkU375vzY01lO7LlShCqK7Xl K/hOksCji1aBz0ZX7An0oLjwrOHn0hHMrDezEm24hKDFhvxxuXJqcNMaFMCkwB4K2MXW/X x3I4Sqg3puZ0Xd6cnvI4e2n7xZx3oBazyCc61cmL9wMya+Q+KLcXmVQJx+z6eicWr/hm9i W/PQH+4AuHyU9Eyy/b5W799HegxG2s3pf1WTheMO9rrElpIkWR0MFITRhcViP4ce7Silht YFsdcapfBWWMYYe2ReMJRG0PKZbO00Ipzonof1s9LwYnnQmKJYYuw0eH92ZznA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=P3rDxq0H; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1732196046; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=qZpi51ataTgQa4NFq2wLpOxyuEVMz+uXoqA3q/N+ceE=; b=M9jYHcQR7FBczczdLceseyyO3a2aOl9gOEYdfg0V0Arfo2RNGPYX4/gdPs9DNlw2pwknnm DR21yXHUMTlJFyRyhZTa09sIvKLnLPAHd/S/bXrg1m1051G0S8W1C9wcJTChNKrZZkLivM cNrdUqN75+7T1ErKDeWH/CQgHcAiZhTGHDTXpl25bcR8BNBzzdFXHGqsc4SqH99+p/0fmx J1STetOqYzUWAMflKk5EQnC1ztyRPtHy5dd88MZzCR+lekx7wYz1DLhWcwuVmt+XvDN9IG br/6C3ua7dSOc+Os3mYf0B4iIvxO6rhGoF34Sq7geoPZ2hx8QQW3eipYHK7eXg== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A1EC41F1F3 for ; Thu, 21 Nov 2024 14:34:05 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tE6ZW-0004Lg-Lp; Thu, 21 Nov 2024 07:46:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tE6ZP-0004Ku-Rp for guix-patches@gnu.org; Thu, 21 Nov 2024 07:46:04 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tE6ZO-0006vP-0Z for guix-patches@gnu.org; Thu, 21 Nov 2024 07:46:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:From:Date:To:In-Reply-To:References:Subject; bh=qZpi51ataTgQa4NFq2wLpOxyuEVMz+uXoqA3q/N+ceE=; b=P3rDxq0HqxLia6n0BujPhlxSLfwbZyZ8WKpvIUGWMVmn2U4/yuUnCeIMVuY3bAqRZOXalEID8LGrKxFCNbAlOIUL/KozD71RsviLq4jhPhqgaysLAXz+jX2hwHaZfrY7dt702yIj8WRKjbxcONfZQSYT5d2+39y8rigPLiCuqNG10OBbLVeQq36c0TpwlksGHU6Gpyk5nG/0onUsCnUe2AG2PnjlxvLI1Q8xNxwhbqTj7152fB39Un8OBMEGvMSsRE/MDUosa4rc/IF5IocACYE+ycPKhkKz5M+U7UOZ7lVL8qPsgOgTR+BVRbAhTwI2+g5kAKRrJ2M90yz9asYHuQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tE6ZN-0000ad-Qs for guix-patches@gnu.org; Thu, 21 Nov 2024 07:46:01 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74459] [PATCH 2/8] guix: lint: Refine description start check logic. References: In-Reply-To: Resent-From: Gabriel Wicki Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 21 Nov 2024 12:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74459 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74459@debbugs.gnu.org Received: via spool by 74459-submit@debbugs.gnu.org id=B74459.17321931141838 (code B ref 74459); Thu, 21 Nov 2024 12:46:01 +0000 Received: (at 74459) by debbugs.gnu.org; 21 Nov 2024 12:45:14 +0000 Received: from localhost ([127.0.0.1]:49428 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6YY-0000TQ-CD for submit@debbugs.gnu.org; Thu, 21 Nov 2024 07:45:14 -0500 Received: from cotopaxi.ee.ethz.ch ([129.132.148.196]:53547) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tE6YT-0000SX-7K for 74459@debbugs.gnu.org; Thu, 21 Nov 2024 07:45:09 -0500 Received: from localhost (antispam.ee.ethz.ch [129.132.2.16]) by cotopaxi.ee.ethz.ch (Postfix) with ESMTP id D4BF720026 for <74459@debbugs.gnu.org>; Thu, 21 Nov 2024 13:44:59 +0100 (CET) X-Virus-Scanned: by amavisd at antispam.ee.ethz.ch Received: from cotopaxi.ee.ethz.ch ([129.132.148.196]) by localhost (antispam.ee.ethz.ch [129.132.2.16]) (amavisd-new, port 10028) with ESMTP id ARlIq4z8b3LH for <74459@debbugs.gnu.org>; Thu, 21 Nov 2024 13:44:55 +0100 (CET) Received: from blackbox (212-51-128-25.fiber7.init7.net [212.51.128.25]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: gabriel) by cotopaxi.ee.ethz.ch (Postfix) with ESMTPSA for <74459@debbugs.gnu.org>; Thu, 21 Nov 2024 13:44:55 +0100 (CET) Date: Thu, 21 Nov 2024 13:44:52 +0100 From: Gabriel Wicki Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -6.55 X-Spam-Score: -6.55 X-Migadu-Queue-Id: A1EC41F1F3 X-Migadu-Scanner: mx10.migadu.com X-TUID: hDGdnZsG4cfW 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 --- guix/lint.scm | 24 +++++++++++++++--------- tests/lint.scm | 25 +++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/guix/lint.scm b/guix/lint.scm index 31d366af46..39edf93219 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021-2023 Maxime Devos ;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2024 Gabriel Wicki ;;; ;;; This file is part of GNU Guix. ;;; @@ -437,15 +438,20 @@ (define (check-description-style package) '())) (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))) + (first-word + (regexp-substitute/global #f "_" initial + 'pre "-" 'post))) + (if (or (string-null? description) + (properly-starts-sentence? description) + (string-prefix-ci? first-word (package-name package)) + (string-suffix-ci? first-word (package-name package))) + '() + (list + (make-warning + package + (G_ "description should start with an upper-case letter or digit") + #:field 'description))))) (define (check-end-of-sentence-space description) "Check that an end-of-sentence period is followed by two spaces." diff --git a/tests/lint.scm b/tests/lint.scm index b899ebc700..9297bfbaac 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -11,6 +11,7 @@ ;;; Copyright © 2020 Tobias Geerinckx-Rice ;;; Copyright © 2021 Xinglu Chen ;;; Copyright © 2021, 2023 Maxime Devos +;;; Copyright © 2024 Gabriel Wicki ;;; ;;; This file is part of GNU Guix. ;;; @@ -132,6 +133,30 @@ (define (warning-contains? str warnings) (description "x is a dummy package.")))) (check-description-style pkg))) +(test-equal "description: may start with beginning of package name" + '() + (let ((pkg (dummy-package "xyz-0.1" + (description "xyz is a dummy package.")))) + (check-description-style pkg))) + +(test-equal "description: may start with end of package name" + '() + (let ((pkg (dummy-package "foobar-xyz" + (description "xyz is a dummy package.")))) + (check-description-style pkg))) + +(test-equal "description: may start with non-hyphenated package name" + '() + (let ((pkg (dummy-package "foobar-xyz-minimal" + (description "foobar_xyz is a dummy package.")))) + (check-description-style pkg))) + +(test-equal "description: may start with end of package name" + '() + (let ((pkg (dummy-package "foo-bar" + (description "bar is some thing in foo.")))) + (check-description-style pkg))) + (test-equal "description: two spaces after end of sentence" "sentences in description should be followed by two spaces; possible infraction at 3" (single-lint-warning-message -- 2.46.0