From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id WK6dAVQ3TmdBMAAA62LTzQ:P1 (envelope-from ) for ; Mon, 02 Dec 2024 22:40:20 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id WK6dAVQ3TmdBMAAA62LTzQ (envelope-from ) for ; Mon, 02 Dec 2024 23:40:20 +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=jJNyKiE9; 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"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1733179219; 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=2CoWKRuApDICyBDtPCedjxg4JnZjNuU0cJw7a4Z6e/I=; b=cEht9bLJRhChulXGNgCC1kP6M2JT4tnOQSlW/XbDL+tDXBl5rEBppaZsYLSWHVE+zfJ2jb 08AXQ7g1WH+bxODqUfL/kcETCrHSoB63bg/4GtmSNYxVEzgPvnIc3O2hntNxWUkTSQGVkF OHaAxSuSAyIUv53JGWiOHYOzMvXKZyEYwHiODCNn2jMk4c35oc2gSaLNA5zrRKPeDIMN5k JeV+zTrNcACDMZ8Oc20EcBd6FvUGrOCSoRc+6WcFK1Q9AgCz72DH6jkVJBSODUvTHvSVE8 aGbO1M81bT7SEIaTeu63gLwY3kZQfaagKegM2xc1lEEARmhEbpLcoq2y/AdAyg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=jJNyKiE9; 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"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1733179219; a=rsa-sha256; cv=none; b=XqLkMBuJ1RBKxw3U0GYtgiD9mvHPP0ZGstZp3SoLlCRhejQeo6UR/ab2YH0LxPtIwuQNdu cFM3vBbt6SBp/CS7fQ8U+SnFP6Kl2OyLys4aDs6i0w72BvGcFhzJQ9U/apQimd4B7ho33s MHc5wT68IoQ8NTRp8J2mNME2IYAvqnfu6R1SIoyjig0MWS+XKnQ7qplQEAJpzxD6xubuJi Pcn8gxg1os5mLNmM8KDUvVhR/r2RrzvWWxsr7J9v4yW/ljZcombW/Q8NsiELSfn1agurpn an+wRbKcGv1DLNVkQ2alQLuBNdJVTswPandFFA1C6tUIORmz6AetEOIxdyQd9g== 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 E0FED88FF7 for ; Mon, 02 Dec 2024 23:40:19 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tIF5I-0007rT-SJ; Mon, 02 Dec 2024 17:40:04 -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 1tIF5H-0007qL-FO for guix-patches@gnu.org; Mon, 02 Dec 2024 17:40:03 -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 1tIF5H-0006dj-6M for guix-patches@gnu.org; Mon, 02 Dec 2024 17:40: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=2CoWKRuApDICyBDtPCedjxg4JnZjNuU0cJw7a4Z6e/I=; b=jJNyKiE9fhuG0ELLNXgRCqa973GFr5NykMFdAH3IipMw++lTOHz7axTchZUbBFQjqHC5pedyb0SHqBkDkVGnjapwYItmpc1FJNURLLWoN3GUECZaUvwIHSu7lmI1q/lv11zf0z9guytcfnwL/Z2W5d2xjmcbXrgIOlwsRiQBhBlgG3aFq9S+PGpXzKmOzhIARq/JFk6CYDlJRGzVyDwmVZ2IRJthIGhSVLwxorpLNMQLeTGaosg5XzwG+LAbaVDXs5jBm87EPTIov7keL+v2DSJKMxCNJTu8VBvVOOpT5qwZwgCz3Zv0GFQg98RWQEDSZa9qv256Log7NcFig7owpA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tIF5H-0004AF-0y for guix-patches@gnu.org; Mon, 02 Dec 2024 17:40:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74459] [PATCH v2 6/7] guix: lint: Ignore initials from double space check. References: In-Reply-To: Resent-From: Gabriel Wicki Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 02 Dec 2024 22:40:02 +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.173317920015986 (code B ref 74459); Mon, 02 Dec 2024 22:40:02 +0000 Received: (at 74459) by debbugs.gnu.org; 2 Dec 2024 22:40:00 +0000 Received: from localhost ([127.0.0.1]:56883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tIF5E-00049m-8O for submit@debbugs.gnu.org; Mon, 02 Dec 2024 17:40:00 -0500 Received: from cotopaxi.ee.ethz.ch ([129.132.148.196]:46703) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tIF5C-00049V-LQ for 74459@debbugs.gnu.org; Mon, 02 Dec 2024 17:39:59 -0500 Received: from localhost (antispam.ee.ethz.ch [129.132.2.16]) by cotopaxi.ee.ethz.ch (Postfix) with ESMTP id 248CF1FFFF for <74459@debbugs.gnu.org>; Mon, 2 Dec 2024 23:39:53 +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 mPpMhD7T3zdo for <74459@debbugs.gnu.org>; Mon, 2 Dec 2024 23:39:51 +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>; Mon, 2 Dec 2024 23:39:51 +0100 (CET) Date: Mon, 2 Dec 2024 23:39:48 +0100 From: Gabriel Wicki Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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-Scanner: mx11.migadu.com X-Migadu-Spam-Score: -4.01 X-Spam-Score: -4.01 X-Migadu-Queue-Id: E0FED88FF7 X-TUID: yEw4zT9EJY6W Prevent false positives in initials as the are commonly used in names, e.g. Margaret E. Hamilton - which obviously do not end sentences. Check whether a period character `.' is preceded by at least two characters. This should save us from false positives when linting. * guix/lint.scm(check-description-style)[check-end-of-sentence-space] Add condition. * tests/lint.scm: Add test case. Change-Id: I42a1365aaaed2afc7308b88ebd4b0720ad362761 --- guix/lint.scm | 15 ++++++++++----- tests/lint.scm | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/guix/lint.scm b/guix/lint.scm index ee2059d812..1c8be911eb 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -466,11 +466,16 @@ (define (check-description-style package) (reverse (fold-matches "\\. [A-Z]" description '() (lambda (m r) - ;; Filter out matches of common abbreviations. - (if (find (lambda (s) - (string-suffix-ci? s (match:prefix m))) - '("i.e" "e.g" "a.k.a" "resp")) - r (cons (match:start m) r))))))) + ;; Filter out matches of common abbreviations and + ;; initials. + (let ((pre (match:prefix m))) + (if (or + (string-match "[A-Z]$" pre) ;; Initial found + (find (lambda (s) + (string-suffix-ci? s pre)) + '("i.e" "e.g" "a.k.a" "resp"))) + r + (cons (match:start m) r)))))))) (if (null? infractions) '() (list diff --git a/tests/lint.scm b/tests/lint.scm index 47e31a69bf..09be160f5d 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -173,7 +173,7 @@ (define (warning-contains? str warnings) '() (let ((pkg (dummy-package "x" (description - "E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD).")))) + "E.g. Foo, i.e. Bar resp. Baz (a.k.a. DVD). Name O. Person")))) (check-description-style pkg))) (test-equal "description: may not contain trademark signs: ™" -- 2.46.0