From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UM9cGueGeGANIQAAgWs5BA (envelope-from ) for ; Thu, 15 Apr 2021 20:33:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KK7TFOeGeGAlegAAbx9fmQ (envelope-from ) for ; Thu, 15 Apr 2021 18:33:11 +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 BDEB812CCB for ; Thu, 15 Apr 2021 20:33:10 +0200 (CEST) Received: from localhost ([::1]:56942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lX6nd-0005PX-Hw for larch@yhetil.org; Thu, 15 Apr 2021 14:33:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX6nW-0005OK-Mn for guix-patches@gnu.org; Thu, 15 Apr 2021 14:33:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lX6nW-0005Dg-DV for guix-patches@gnu.org; Thu, 15 Apr 2021 14:33:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lX6nW-0000TU-AV for guix-patches@gnu.org; Thu, 15 Apr 2021 14:33:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47804] [PATCH v2] lint: Warn about underscores in package names. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 15 Apr 2021 18:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47804 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47804@debbugs.gnu.org Cc: Maxime Devos X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16185115261740 (code B ref -1); Thu, 15 Apr 2021 18:33:02 +0000 Received: (at submit) by debbugs.gnu.org; 15 Apr 2021 18:32:06 +0000 Received: from localhost ([127.0.0.1]:39179 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lX6mc-0000S0-FG for submit@debbugs.gnu.org; Thu, 15 Apr 2021 14:32:06 -0400 Received: from lists.gnu.org ([209.51.188.17]:57840) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lX6mZ-0000Rr-Nw for submit@debbugs.gnu.org; Thu, 15 Apr 2021 14:32:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX6mX-00054y-Vj for guix-patches@gnu.org; Thu, 15 Apr 2021 14:32:02 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:47486 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lX6mO-0004m7-NN for guix-patches@gnu.org; Thu, 15 Apr 2021 14:32:01 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1618511505; bh=NcZC8tMC1i5grbNGiu9BNryoliYTp3NofHQT9VpO84Q=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=LysxMsHl6XH62tKjG6z5D61mwSsiSJ8zM/nFqqbAumPUtQtfyH/544Hq9KLSorJbw HhKmzo1T+/okX9sMYeWLT0MswQUtUoRyf8J3CsKl63yU116AOUY1TdS6dhzoFEEpyp DuIfQvwGOMpLmpvxjLIRa2ev6N41yuaTB01cZZWY= In-Reply-To: References: Message-Id: <94d0b8cb2322ed634442c0ebb79589e5dc05e526.1618511382.git.public@yoctocell.xyz> Date: Thu, 15 Apr 2021 20:31:44 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.5, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1618511591; 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: 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=H5jeP/z1WnlIx6M2BDdeHB/X/PJbfFxbnxjvPS/Buc8=; b=SYZzJZ0u1AGMBqsdgK0z5DhOO7B2yjFpNCqV4Vio/fY50lHN7dHaMoEKKsiSitD8bBxMI2 NyHiV3NdLGXEYV6thQSzLWXtYzxoLXQBOtmQP2tyf43U5OeJfpT6PRgES2aY7Xambe1VL7 AZlukPlHVw0mM55thpswljMxyXfcaHmp6pM6uVFmI0jnLMaM7GLw6+EQIMWp9Bn6C98vdW UzGgPb5IbaWprCQSFfDiOLTGhOxmY7Uh6ron0OVqn9cmBXsfq4jcnu095+OJbh8eWcLLb4 ljqE4TYMaqOzWJbKTBgsRIdmQyrjhVnO0/mjsqKaVKDdHo8aeKcL7K9qSBHgqQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618511591; a=rsa-sha256; cv=none; b=NbNhA31T+aIQ8BCm5lu5VfQTFFNt6Iny7OEN2yJqEUF940+CagLqg2+i1m3T8wtxZP9O/+ fCw0ocnsadYTwhPC/nvgJvmrMQViB5wzIL7c6IiEDH+OP3tnw8shXGHmWhNmLqh4wCya/M jBj35xLqGNi41v1gK1csPFSerDQiw9Bx8lVHDTY0t5ZohRkDojP7THS93hLpXtTESrse3Y H8/HOJZjMgR2lZhVMUa+goowOEoJCa+jIw7Atq6ZjfSO3NFyIjqbO5e9oHOojIJHwpLm65 dCxxYQT/lGL6rmq5hsudvSd26+tlKLbexCV4JVsZRan+2UNXr3HoxQ3mXpZAMg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=LysxMsHl; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.34 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=LysxMsHl; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: BDEB812CCB X-Spam-Score: -0.34 X-Migadu-Scanner: scn0.migadu.com X-TUID: o/gcG8J+LXI5 As per section '16.4.2 Package Naming' in the manual, use hyphens instead of underscores in package names. * guix/lint.scm (check-name): Check whether the package name contains underscores. * tests/lint.scm ("name: use underscore in package name"): New test. --- Changes since v1: - Add test for package name with underscore. guix/lint.scm | 24 ++++++++++++++++-------- tests/lint.scm | 7 +++++++ 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/guix/lint.scm b/guix/lint.scm index a7d6bbba4f..38699e2927 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -11,6 +11,7 @@ ;;; Copyright =C2=A9 2018, 2019 Arun Isaac ;;; Copyright =C2=A9 2020 Chris Marusich ;;; Copyright =C2=A9 2020 Timothy Sample +;;; Copyright =C2=A9 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -81,6 +82,7 @@ check-synopsis-style check-derivation check-home-page + check-name check-source check-source-file-name check-source-unstable-tarball @@ -173,14 +175,20 @@ (define (check-name package) "Check whether PACKAGE's name matches our guidelines." (let ((name (package-name package))) - ;; Currently checks only whether the name is too short. - (if (and (<=3D (string-length name) 1) - (not (string=3D? name "r"))) ; common-sense exception - (list - (make-warning package - (G_ "name should be longer than a single character") - #:field 'name)) - '()))) + (cond + ;; Currently checks only whether the name is too short. + ((and (<=3D (string-length name) 1) + (not (string=3D? name "r"))) ; common-sense exception + (list + (make-warning package + (G_ "name should be longer than a single character") + #:field 'name))) + ((string-match "_" name) + (list + (make-warning package + (G_ "name should use hyphens instead of underscores") + #:field 'name))) + (else '())))) =20 (define (properly-starts-sentence? s) (string-match "^[(\"'`[:upper:][:digit:]]" s)) diff --git a/tests/lint.scm b/tests/lint.scm index bd8604f589..a2c8665142 100644 --- a/tests/lint.scm +++ b/tests/lint.scm @@ -8,6 +8,7 @@ ;;; Copyright =C2=A9 2017 Efraim Flashner ;;; Copyright =C2=A9 2018, 2019 Arun Isaac ;;; Copyright =C2=A9 2020 Timothy Sample +;;; Copyright =C2=A9 2021 Xinglu Chen ;;; ;;; This file is part of GNU Guix. ;;; @@ -270,6 +271,12 @@ (description "Imagine this is Taylor UUCP.")))) (check-synopsis-style pkg))) =20 +(test-equal "name: use underscore in package name" + "name should use hyphens instead of underscores" + (single-lint-warning-message + (let ((pkg (dummy-package "under_score"))) + (check-name pkg)))) + (test-equal "inputs: pkg-config is probably a native input" "'pkg-config' should probably be a native input" (single-lint-warning-message base-commit: a5bbd38fd131282e928144e869dcdf1e09259085 --=20 2.31.1