diff options
author | Tobias Geerinckx-Rice via Bug reports for GNU Guix <[email protected]> | 2021-03-09 22:41:58 +0100 |
---|---|---|
committer | Tobias Geerinckx-Rice <[email protected]> | 2021-04-01 14:35:59 +0200 |
commit | 1126bb9cf33f10f004a5f53331389c777c025e75 (patch) | |
tree | fa8d9023da1b6d710088475dce19ee84cb0f0585 | |
parent | 1b1a61f86a258c417a061da0dca18a969a19b28e (diff) |
lint: Warn about single-character package names.
A common-sense exception is made for R.
* guix/lint.scm (check-name): New procedure.
(%local-checkers): Add it.
-rw-r--r-- | guix/lint.scm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/guix/lint.scm b/guix/lint.scm index be524b2b56..cdd9dd14d7 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2016 Danny Milosavljevic <[email protected]> ;;; Copyright © 2016 Hartmut Goebel <[email protected]> ;;; Copyright © 2017 Alex Kost <[email protected]> -;;; Copyright © 2017 Tobias Geerinckx-Rice <[email protected]> +;;; Copyright © 2017, 2021 Tobias Geerinckx-Rice <[email protected]> ;;; Copyright © 2017, 2018, 2020 Efraim Flashner <[email protected]> ;;; Copyright © 2018, 2019 Arun Isaac <[email protected]> ;;; Copyright © 2020 Chris Marusich <[email protected]> @@ -170,6 +170,18 @@ (requires-store? lint-checker-requires-store? (default #f))) +(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)) + '()))) + (define (properly-starts-sentence? s) (string-match "^[(\"'`[:upper:][:digit:]]" s)) @@ -1447,6 +1459,10 @@ them for PACKAGE." (define %local-checkers (list (lint-checker + (name 'name) + (description "Validate package names") + (check check-name)) + (lint-checker (name 'description) (description "Validate package descriptions") (check check-description-style)) |