From patchwork Sun May 30 20:30:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 29691 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 D580027BC81; 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 9FB2D27BC78 for ; Sun, 30 May 2021 21:32:57 +0100 (BST) Received: from localhost ([::1]:36558 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnS7E-0001MR-QX for patchwork@mira.cbaines.net; Sun, 30 May 2021 16:32:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnS6N-0001LQ-0z for guix-patches@gnu.org; Sun, 30 May 2021 16:32:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48897) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lnS6L-0007Z9-Pf 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 1lnS6L-0004ot-LV for guix-patches@gnu.org; Sun, 30 May 2021 16:32: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 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.162240666618455 (code B ref 48750); Sun, 30 May 2021 20:32:01 +0000 Received: (at 48750) by debbugs.gnu.org; 30 May 2021 20:31:06 +0000 Received: from localhost ([127.0.0.1]:60441 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnS5S-0004nZ-Dr 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]:47388 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnS5N-0004my-C1 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=1622406655; bh=CslEwfv8kXJtf2B78ZoxdcFHNNotN0arfhvVHFy29ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Sslaf/VrQ9IsOYUJRWtPhjuzlxltxqGk2uk7UtWFgtiXFFP/ZTzPncNsmDOmM+cz7 T4kWq3zoBGqkJcErJvD9+l0oAjVGWhPf92xQU/Mv8aM4U2PWEf/M9vBg+HxZXcYnzu 7CDOu1a2yf5ZZuDzrvvvUxugTGuaqqFHRK6IXei4= Date: Sun, 30 May 2021 22:30:31 +0200 Message-Id: <2263996fdbd5853d7c16ea5fade00f1e1c0a448d.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-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(-) base-commit: cefa260fb42693b87545b1baab8cef9723827f80 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