unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#47804] [PATCH] lint: Warn about underscores in package names.
@ 2021-04-15 16:00 Xinglu Chen
  2021-04-15 16:19 ` Maxime Devos
  2021-04-15 18:31 ` [bug#47804] [PATCH v2] " Xinglu Chen
  0 siblings, 2 replies; 7+ messages in thread
From: Xinglu Chen @ 2021-04-15 16:00 UTC (permalink / raw)
  To: 47804

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






^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-04-16 22:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 16:00 [bug#47804] [PATCH] lint: Warn about underscores in package names Xinglu Chen
2021-04-15 16:19 ` Maxime Devos
2021-04-15 18:15   ` Xinglu Chen
2021-04-16 10:19     ` Maxime Devos
2021-04-15 18:31 ` [bug#47804] [PATCH v2] " Xinglu Chen
2021-04-16 20:54   ` bug#47804: [PATCH] " Ludovic Courtès
2021-04-16 21:42     ` [bug#47804] " Julien Lepiller

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).