[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: lint: Add description check for common typos.
From: |
guix-commits |
Subject: |
branch master updated: lint: Add description check for common typos. |
Date: |
Sun, 24 Oct 2021 17:32:37 -0400 |
This is an automated email from the git hooks/post-receive script.
vagrantc pushed a commit to branch master
in repository guix.
The following commit(s) were added to refs/heads/master by this push:
new b5f45a2 lint: Add description check for common typos.
b5f45a2 is described below
commit b5f45a21c27b80210753e184e52708bb75a347bb
Author: Vagrant Cascadian <vagrant@debian.org>
AuthorDate: Sun Oct 24 04:00:15 2021 -0700
lint: Add description check for common typos.
Fixes: https://issues.guix.gnu.org/44675
* guix/lint.scm (check-description-typo): Add check for occurences of
"This packages", "This modules", "allows to" and "permits to" in package
descriptions.
* tests/lint.scm: Add tests for "This packages" and "allows to".
---
guix/lint.scm | 19 +++++++++++++++++++
tests/lint.scm | 14 ++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/guix/lint.scm b/guix/lint.scm
index 7b02b9c..ac2e7b3 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -321,6 +321,21 @@ markup is valid return a plain-text version of
DESCRIPTION, otherwise #f."
(G_ "Texinfo markup in description is invalid")
#:field 'description))))
+ (define (check-description-typo description typo-corrections)
+ "Check that DESCRIPTION does not contain typo, with optional correction"
+ (append-map
+ (match-lambda
+ ((typo . correction)
+ (if (string-contains description typo)
+ (list
+ (make-warning package
+ (G_
+ (format #false
+ "description contains typo '~a'~@[, should
be '~a'~]"
+ typo correction))))
+ '())))
+ typo-corrections))
+
(define (check-trademarks description)
"Check that DESCRIPTION does not contain '™' or '®' characters. See
http://www.gnu.org/prep/standards/html_node/Trademarks.html."
@@ -401,6 +416,10 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
(check-not-empty description)
(check-quotes description)
(check-trademarks description)
+ (check-description-typo description '(("This packages" . "This
package")
+ ("This modules" . "This module")
+ ("allows to" . #f)
+ ("permits to" . #f)))
;; Use raw description for this because Texinfo rendering
;; automatically fixes end of sentence space.
(check-end-of-sentence-space description)
diff --git a/tests/lint.scm b/tests/lint.scm
index 699a750..6a7eed0 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -177,6 +177,20 @@
(description "Whitespace. "))))
(check-description-style pkg))))
+(test-equal "description: pluralized 'This package'"
+ "description contains typo 'This packages', should be 'This package'"
+ (single-lint-warning-message
+ (let ((pkg (dummy-package "x"
+ (description "This packages is a typo."))))
+ (check-description-style pkg))))
+
+(test-equal "description: grammar 'allows to'"
+ "description contains typo 'allows to'"
+ (single-lint-warning-message
+ (let ((pkg (dummy-package "x"
+ (description "This package allows to do
stuff."))))
+ (check-description-style pkg))))
+
(test-equal "synopsis: not a string"
"invalid synopsis: #f"
(single-lint-warning-message
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: lint: Add description check for common typos.,
guix-commits <=