From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id CEtoHClCdWFkOQAAgWs5BA (envelope-from ) for ; Sun, 24 Oct 2021 13:23:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id YIr9FylCdWHQKQAAbx9fmQ (envelope-from ) for ; Sun, 24 Oct 2021 11:23:21 +0000 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 D1D2331DA1 for ; Sun, 24 Oct 2021 13:23:19 +0200 (CEST) Received: from localhost ([::1]:60596 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mebaw-0000kg-0V for larch@yhetil.org; Sun, 24 Oct 2021 07:23:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mebah-0000jm-11 for bug-guix@gnu.org; Sun, 24 Oct 2021 07:23:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54688) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mebag-0007YH-KN for bug-guix@gnu.org; Sun, 24 Oct 2021 07:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mebag-0001Ir-G9 for bug-guix@gnu.org; Sun, 24 Oct 2021 07:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#44675: guix lint: support for spellchecker or basic grammar Resent-From: Vagrant Cascadian Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 24 Oct 2021 11:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44675 X-GNU-PR-Package: guix X-GNU-PR-Keywords: easy To: zimoun Received: via spool by 44675-submit@debbugs.gnu.org id=B44675.16350745454952 (code B ref 44675); Sun, 24 Oct 2021 11:23:02 +0000 Received: (at 44675) by debbugs.gnu.org; 24 Oct 2021 11:22:25 +0000 Received: from localhost ([127.0.0.1]:38001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meba4-0001Ho-Rk for submit@debbugs.gnu.org; Sun, 24 Oct 2021 07:22:25 -0400 Received: from cascadia.aikidev.net ([173.255.214.101]:45666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meba3-0001Hc-CS for 44675@debbugs.gnu.org; Sun, 24 Oct 2021 07:22:23 -0400 Received: from localhost (unknown [IPv6:2600:3c01:e000:21:21:21:0:100b]) (Authenticated sender: vagrant@cascadia.debian.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id A6C011AA2C; Sun, 24 Oct 2021 04:22:17 -0700 (PDT) From: Vagrant Cascadian In-Reply-To: <865ytpzcfc.fsf@gmail.com> References: <87ima6rrri.fsf@yucca> <87tunznsi7.fsf@yucca> <2f3077c0d040e4b40db19d98195845e124b064d3.camel@telenet.be> <87o8e6nqvv.fsf@yucca> <87o8dqmozo.fsf@gnu.org> <87zgvz129e.fsf@yucca> <8735ouotkl.fsf@yucca> <865ytpzcfc.fsf@gmail.com> Date: Sun, 24 Oct 2021 04:22:14 -0700 Message-ID: <87mtmyr7kp.fsf@yucca> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 44675@debbugs.gnu.org Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1635074599; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: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; bh=dPN+3F5ze5DKQaqMoioor4CsI95neBhWltkmmhJJewU=; b=gI5Aq/3D6E9s3o8fwU1qOkoHEWG0Z0URoKPRbKbjoaHDLQNBid25224BDYcNI0P0iMWeOF F/eZgOePff9anSUh2E7n6atsGRuASe70gikBfBWzqxnvG2j84ymaNnM2lnANiRShUhn7F2 ulh9uJPQLHYe0WLItil4hZyHMDtijCExiwY5vwecWJNhLfsoeFAUzxMsmuXGhDTeKHr20n BHM04azFTK0x9I/ghmeYNOgEUxCPB7HafhwXynOuOd8EeTFnfZ8VNHHIpa8nOe7O/kyGE6 MeWuMtr002klr7B6UZQBalAp3MOOvJd3BNiluCl16wytpwmTu9f3/V/bZp8xnQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635074599; a=rsa-sha256; cv=none; b=l0KlJ4sQuPsqnmLR7+AOZ7zB7W5DVFbMA0W6BOvVbVUOLLIU825oVIL3xqFU+7CtuirNkT Mq8i9HsXO5zG2xrqbO0KU8wYkErozY3n+1fjEBglo44ZV5tNsXVx1Z3DrcRJ6uBaOX7G/X JxHlx9uLS+B2kGM4h/ksIUAdGd1aXjEZA7UG8K4K/GdoONNuUAAfjX50LsZF1ira5MCGY4 zxaEKJeqsu/tfbi0ngNgtriqoqtKBE07D+trYEsTXTXWzMtHuHlqyQQbNMSZUefVhbyDy8 Y4n5S3CVhDg9n8FfhcH59aCgR6g4MwAFYlgwTEux6HeOw3dRhpQMj9Ky+N60zw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -4.42 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: D1D2331DA1 X-Spam-Score: -4.42 X-Migadu-Scanner: scn1.migadu.com X-TUID: 2yHapO3gGJJc --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2021-10-22, zimoun wrote: > On Thu, 21 Oct 2021 at 16:18, Vagrant Cascadian wrot= e: > >> It has been rewritten to easily add new typo checks, but this one so far >> only addresses pluralized "This packages". Would be easy enough to add >> "allows to" but hard to add a suggested fix... > > If I remember correctly the previous discussion, Debian uses an external > tool for spellchecking. Here, the patch uses a list of =E2=80=9Ccommon= =E2=80=9D > mistakes. It is seems an easy good start. :-) Yes, I definitely went for "catch some useful things" rather than trying to be comprehensive... these checks should catch the majority of historical ones I've noticed, but I didn't bother adding one-off typos. > Instead, I would use a list of alist =E2=80=99typo-corrections=E2=80=99 a= s argument. > For instance, > > --8<---------------cut here---------------start------------->8--- > (define (check-description-typo description typo-corrections) > (for-each > (match-lambda > ((typo . correction) > (if (string-contains description typo) > (list > (make-warning ...)) > '()))) > typo-corrections)) > --8<---------------cut here---------------end--------------->8--- So close! Ludo spotted that the for-each needed to be replaced with append-map, and that basically did it! > (check-description-typo description '(("This packages" . "Thi= s package"))) > > which allows easily to add new pattern; such as, > > '(("This packages" . "This package") > ("this packages" . "this package") > ("This modules" . "This module")) > > Then, as a second step, depending on the patterns listed, let see if > there is a pattern inside these patterns. ;-) (Check both capitalize and > lower-case, etc.) I haven't seen case issues in practice for these. I've added "This packages", "This modules", "allows to" and "permits to" to the list while I was at it. I only added tests for "This packages" and "allows to" as the others are so similar I'm not sure it's worth testing... Here's to hoping for a guix with fewer glaring typos with which to craft guix poetry. :) New patch attached! live well, vagrant --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: inline; filename=0001-lint-Add-description-check-for-common-typos.patch Content-Transfer-Encoding: quoted-printable From=20a171769da0f737468e06866164eadf1e720764ba Mon Sep 17 00:00:00 2001 From: Vagrant Cascadian Date: Sun, 24 Oct 2021 04:00:15 -0700 Subject: [PATCH] lint: Add description check for common typos. Fixes: https://issues.guix.gnu.org/44675 * guix/lint.scm (check-description-typo): Add check for occurances of "This packages", "This modules", "allows to" and "permits to" in package descriptions. * tests/lint.scm: Add tests for "This packages" and "allows to". =2D-- guix/lint.scm | 19 +++++++++++++++++++ tests/lint.scm | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/guix/lint.scm b/guix/lint.scm index 7b02b9cec0..ac2e7b3841 100644 =2D-- a/guix/lint.scm +++ b/guix/lint.scm @@ -321,6 +321,21 @@ markup is valid return a plain-text version of DESCRIP= TION, otherwise #f." (G_ "Texinfo markup in description is invalid") #:field 'description)))) =20 + (define (check-description-typo description typo-corrections) + "Check that DESCRIPTION does not contain typo, with optional correctio= n" + (append-map + (match-lambda + ((typo . correction) + (if (string-contains description typo) + (list + (make-warning package + (G_ + (format #false + "description contains typo '~a'~@[, sho= uld be '~a'~]" + typo correction)))) + '()))) + typo-corrections)) + (define (check-trademarks description) "Check that DESCRIPTION does not contain '=E2=84=A2' or '=C2=AE' chara= cters. See http://www.gnu.org/prep/standards/html_node/Trademarks.html." @@ -401,6 +416,10 @@ by two spaces; possible infraction~p at ~{~a~^, ~}") (check-not-empty description) (check-quotes description) (check-trademarks description) + (check-description-typo description '(("This packages" . "This pa= ckage") + ("This modules" . "This mod= ule") + ("allows to" . #f) + ("permits to" . #f))) ;; Use raw description for this because Texinfo rendering ;; automatically fixes end of sentence space. (check-end-of-sentence-space description) diff --git a/tests/lint.scm b/tests/lint.scm index 699a750eb9..6a7eed02e0 100644 =2D-- a/tests/lint.scm +++ b/tests/lint.scm @@ -177,6 +177,20 @@ (description "Whitespace. ")))) (check-description-style pkg)))) =20 +(test-equal "description: pluralized 'This package'" + "description contains typo 'This packages', should be 'This package'" + (single-lint-warning-message + (let ((pkg (dummy-package "x" + (description "This packages is a typo.")))) + (check-description-style pkg)))) + +(test-equal "description: grammar 'allows to'" + "description contains typo 'allows to'" + (single-lint-warning-message + (let ((pkg (dummy-package "x" + (description "This package allows to do stuff= .")))) + (check-description-style pkg)))) + (test-equal "synopsis: not a string" "invalid synopsis: #f" (single-lint-warning-message =2D-=20 2.30.2 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCYXVB5wAKCRDcUY/If5cW qikvAQDiaQqa8kHiYS4AWxIus3x1VkdMUhmBTLOMgolSxqIkcAD8CmhSqhprnrfp 8P3vwacCFwk7lCGy4soPAYKsBFPJuQc= =mfD9 -----END PGP SIGNATURE----- --==-=-=--