From patchwork Sun May 30 20:30:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 29690 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 8DCCE27BC81; Sun, 30 May 2021 21:32:57 +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 314A527BC78 for ; Sun, 30 May 2021 21:32:57 +0100 (BST) Received: from localhost ([::1]:36550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnS7E-0001Lh-CL for patchwork@mira.cbaines.net; Sun, 30 May 2021 16:32:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnS6N-0001LR-7a for guix-patches@gnu.org; Sun, 30 May 2021 16:32:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48898) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnS6M-0007ZR-4N for guix-patches@gnu.org; Sun, 30 May 2021 16:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lnS6M-0004p1-1a for guix-patches@gnu.org; Sun, 30 May 2021 16:32: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 20:32: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 Cc: Xinglu Chen Received: via spool by 48750-submit@debbugs.gnu.org id=B48750.162240666718461 (code B ref 48750); Sun, 30 May 2021 20:32:01 +0000 Received: (at 48750) by debbugs.gnu.org; 30 May 2021 20:31:07 +0000 Received: from localhost ([127.0.0.1]:60443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnS5S-0004nc-L5 for submit@debbugs.gnu.org; Sun, 30 May 2021 16:31:06 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:47394 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnS5Q-0004n0-GG for 48750@debbugs.gnu.org; Sun, 30 May 2021 16:31:04 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622406659; bh=a9H0dJGGJRRK8PBVjQO1An2TL4mqZ9LGIrTXFEnLL4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EVLA8Ogc7YX0BS298xjssQYGx2LmWU5RKtjaJVgNgFIxZhe152/XWcrxlYbVFFqx6 XAn/60OySEe73vKq8eOGPGz5wlmUhkumwh9OXrCBKDHeTaaSJEXOyvoU6p55iI9AHv H+bqR+0maCY5CJvh61/dktImH7S3wfpSJ/pmhtRc= Date: Sun, 30 May 2021 22:30:32 +0200 Message-Id: <03b2b2591e76a0bf55419c81c39e8f063b9b1d65.1622406578.git.public@yoctocell.xyz> In-Reply-To: References: 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..f4b601cf4f 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 description) (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..25615085df 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 ((pkg (dummy-package "x" + (description "Whitespace. ")))) + (check-description-style pkg)))) + (test-equal "synopsis: not a string" "invalid synopsis: #f" (single-lint-warning-message