From patchwork Sun May 30 19:42:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 29687 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8AB8E27BC81; Sun, 30 May 2021 20:45:52 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5F89827BC78 for ; Sun, 30 May 2021 20:45:52 +0100 (BST) Received: from localhost ([::1]:39016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnRNf-0006A2-IZ for patchwork@mira.cbaines.net; Sun, 30 May 2021 15:45:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnRKw-00036F-JE for guix-patches@gnu.org; Sun, 30 May 2021 15:43:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnRKv-0002VH-Tb for guix-patches@gnu.org; Sun, 30 May 2021 15:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnRKv-0003c4-RW for guix-patches@gnu.org; Sun, 30 May 2021 15:43:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48750] [PATCH 1/2] lint: Check for trailing whitespace in synopsis. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 30 May 2021 19:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48750 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48750@debbugs.gnu.org Received: via spool by 48750-submit@debbugs.gnu.org id=B48750.162240376513863 (code B ref 48750); Sun, 30 May 2021 19:43:01 +0000 Received: (at 48750) by debbugs.gnu.org; 30 May 2021 19:42:45 +0000 Received: from localhost ([127.0.0.1]:60378 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnRKe-0003bX-TU for submit@debbugs.gnu.org; Sun, 30 May 2021 15:42:45 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:46304 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnRKd-0003bL-Of for 48750@debbugs.gnu.org; Sun, 30 May 2021 15:42:44 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622403758; bh=JdFH68gLYKts9C6/HGi5LqfW6UoeCYetIW5jLRpspkA=; h=From:To:Subject:In-Reply-To:References:Date; b=TXLnwRzNCLzpp9Kc73toxMxJ3dqvr0SI0W1ySWgWHjrtwy+RKt5ZsDNycqmd4/et6 Tu6gFdLnNSD/FR+yRswAapzJlwe1CDvlkPt/O+SHCR2iZ874ydo3xF9T3wh2hOxByE jtOvbrmrDBA3vBhYlrk26YYg755rhqd5g9ZCsnic= In-Reply-To: References: Message-Id: <2263996fdbd5853d7c16ea5fade00f1e1c0a448d.1622403325.git.public@yoctocell.xyz> Date: Sun, 30 May 2021 21:42:37 +0200 MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/lint.scm (check-synopsis-style): Check for trailing whitespace. * tests/lint.scm ("synopsis: contains trailing whitespace"): New test. --- guix/lint.scm | 12 +++++++++++- tests/lint.scm | 7 +++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/guix/lint.scm b/guix/lint.scm index a2d6418b85..d2ef4f34b2 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -456,13 +456,23 @@ markup is valid return a plain-text version of SYNOPSIS, otherwise #f." (G_ "Texinfo markup in synopsis is invalid") #:field 'synopsis))))) + (define (check-no-trailing-whitespace synopsis) + "Check that SYNOPSIS doesn't have trailing whitespace." + (if (string-suffix? " " synopsis) + (list + (make-warning package + (G_ "synopsis contains trailing whitespace") + #:field 'synopsis)) + '())) + (define checks (list check-proper-start check-final-period check-start-article check-start-with-package-name check-synopsis-length - check-texinfo-markup)) + check-texinfo-markup + check-no-trailing-whitespace)) (match (package-synopsis package) ("" diff --git a/tests/lint.scm b/tests/lint.scm index d54fafc1d2..dddbf0679f 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -271,6 +271,13 @@ (description "Imagine this is Taylor UUCP.")))) (check-synopsis-style pkg))) +(test-equal "synopsis: contains trailing whitespace" + "synopsis contains trailing whitespace" + (single-lint-warning-message + (let ((pkg (dummy-package "x" + (synopsis "Whitespace ")))) + (check-synopsis-style pkg)))) + (test-equal "name: use underscore in package name" "name should use hyphens instead of underscores" (single-lint-warning-message From patchwork Sun May 30 19:42:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 29686 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 129D227BC81; Sun, 30 May 2021 20:45:52 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D72D027BC78 for ; Sun, 30 May 2021 20:45:51 +0100 (BST) Received: from localhost ([::1]:38974 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnRNf-00068E-1j for patchwork@mira.cbaines.net; Sun, 30 May 2021 15:45:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47958) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnRLu-0003iJ-Hx for guix-patches@gnu.org; Sun, 30 May 2021 15:44:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48836) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnRLu-00034H-Ak for guix-patches@gnu.org; Sun, 30 May 2021 15:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnRLu-0003dm-8g for guix-patches@gnu.org; Sun, 30 May 2021 15:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#48750] [PATCH 2/2] lint: Check for trailing whitespace in description. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 30 May 2021 19:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48750 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48750@debbugs.gnu.org Received: via spool by 48750-submit@debbugs.gnu.org id=B48750.162240378813924 (code B ref 48750); Sun, 30 May 2021 19:44:02 +0000 Received: (at 48750) by debbugs.gnu.org; 30 May 2021 19:43:08 +0000 Received: from localhost ([127.0.0.1]:60382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnRL2-0003cW-6A for submit@debbugs.gnu.org; Sun, 30 May 2021 15:43:08 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:46318 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnRKz-0003bu-FJ for 48750@debbugs.gnu.org; Sun, 30 May 2021 15:43:06 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622403779; bh=MI3eL/24LsP/zExvoDka6O8lC17NY5Hrxd2zx145Axo=; h=From:To:Subject:In-Reply-To:References:Date; b=d0UhsyKE3knmROUlmm1yWPME53Pzd3i/7AXUkuVpULmylG9earKSk+021TURFtiXG weDV5gNqSwBdEgRFwbEAOGb9KMfIwsqTf6eB+2j28auuKnLe3KO8lfHLn9YMknyxfp jPPq8fVw9Wwb1tFdIdU53L8fqvYr6gsu1qlCJh1k= In-Reply-To: References: Message-Id: <7f6526ca35091658589205efeb9f99f5e3a0c1e9.1622403325.git.public@yoctocell.xyz> Date: Sun, 30 May 2021 21:42:59 +0200 MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/lint.scm (check-description-style): Check for trailing whitespace. * tests/lint.scm: ("description: trailing whitespace"): New test. --- guix/lint.scm | 10 ++++++++++ tests/lint.scm | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/guix/lint.scm b/guix/lint.scm index d2ef4f34b2..4fdebc0aff 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -278,6 +278,15 @@ by two spaces; possible infraction~p at ~{~a~^, ~}") infractions) #:field 'description))))) + (define (check-no-trailing-whitespace DESCRIPTION) + "Check that DESCRIPTION doesn't have trailing whitespace." + (if (string-suffix? " " description) + (list + (make-warning package + (G_ "description contains trailing whitespace") + #:field 'description)) + '())) + (let ((description (package-description package))) (if (string? description) (append @@ -287,6 +296,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}") ;; Use raw description for this because Texinfo rendering ;; automatically fixes end of sentence space. (check-end-of-sentence-space description) + (check-no-trailing-whitespace) (match (check-texinfo-markup description) ((and warning (? lint-warning?)) (list warning)) (plain-description diff --git a/tests/lint.scm b/tests/lint.scm index dddbf0679f..5c1e9d3db2 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -160,6 +160,13 @@ (description "This is a 'quoted' thing.")))) (check-description-style pkg)))) +(test-equal "description: trailing whitespace" + "description contains trailing whitespace" + (single-lint-warning-message + (let ((pkgs (dummy-package "x" + (description "Whitespace. ")))) + (check-description-style pkg)))) + (test-equal "synopsis: not a string" "invalid synopsis: #f" (single-lint-warning-message