emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#47804: closed ([PATCH] lint: Warn about underscores in package names


From: GNU bug Tracking System
Subject: bug#47804: closed ([PATCH] lint: Warn about underscores in package names.)
Date: Fri, 16 Apr 2021 20:56:01 +0000

Your message dated Fri, 16 Apr 2021 22:54:47 +0200
with message-id <87eefa2bmw.fsf_-_@gnu.org>
and subject line Re: bug#47804: [PATCH] lint: Warn about underscores in package 
names.
has caused the debbugs.gnu.org bug report #47804,
regarding [PATCH] lint: Warn about underscores in package names.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
47804: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47804
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] lint: Warn about underscores in package names. Date: Thu, 15 Apr 2021 18:00:46 +0200
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.
---
There was some discussion about this on guix-devel[1], but no consensus
was reached.  Should we whitelist certain names like “86_64” or something?

[1]: https://yhetil.org/guix-devel/87v991vkpi.fsf@nckx

 guix/lint.scm | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/guix/lint.scm b/guix/lint.scm
index a7d6bbba4f..d5ad69475e 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018, 2019 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2020 Chris Marusich <cmmarusich@gmail.com>
 ;;; Copyright © 2020 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -173,14 +174,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 (<= (string-length name) 1)
-             (not (string=? 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 (<= (string-length name) 1)
+           (not (string=? 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 '()))))
 
 (define (properly-starts-sentence? s)
   (string-match "^[(\"'`[:upper:][:digit:]]" s))

base-commit: a5bbd38fd131282e928144e869dcdf1e09259085
-- 
2.31.1





--- End Message ---
--- Begin Message --- Subject: Re: bug#47804: [PATCH] lint: Warn about underscores in package names. Date: Fri, 16 Apr 2021 22:54:47 +0200 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
Hi,

Xinglu Chen <public@yoctocell.xyz> skribis:

> 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.

Applied with the minor change below, which avoids regexps
(‘string-match’ performs regexp matches, which is overkill here).

Thank you and thanks Maxime for the review!

Ludo’.

diff --git a/guix/lint.scm b/guix/lint.scm
index 38699e2927..1bebfe03d3 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -183,7 +183,7 @@
        (make-warning package
                      (G_ "name should be longer than a single character")
                      #:field 'name)))
-     ((string-match "_" name)
+     ((string-index name #\_)
       (list
        (make-warning package
                      (G_ "name should use hyphens instead of underscores")

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]