[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44675: guix lint: support for spellchecker or basic grammar
From: |
Vagrant Cascadian |
Subject: |
bug#44675: guix lint: support for spellchecker or basic grammar |
Date: |
Wed, 21 Apr 2021 16:10:40 -0700 |
Control: tags 44675 +patch
On 2020-11-15, Vagrant Cascadian wrote:
> Please consider a guix lint description/synopsis check for basic
> spelling, typo and rudimentary grammar issues.
...
> Many of these are likely to be caught by most spell checking routines;
> I'm not sure if there is anything that would be implementable in pure
> guile, or it if would make sense to call out to an external
> spellchecker.
>
> Some of them might be harder, and obviously we do not want too many
> false positives, but no need to get perfectionist on solving this; even
> just checking for "This packages" would haved detected many of these
> issues!
In the attached patch, I've implemented a simple lint check for "This
packages", which has been fixed in ... 42 packages so far in the git
repository, so maybe this could help catch future ones!
I haven't implemented a more complicated spellchecker or grammar checker
or anything, but at least this is a start.
I think it is also within my skills to address "allows to" and "permits
to", if I'm not heading down the wrong path here...
live well,
vagrant
From d4b851f5722cd6f8d514a4254884d1f7a016b74f Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagrant@debian.org>
Date: Wed, 21 Apr 2021 09:26:45 -0700
Subject: [PATCH] lint: Add description check for check-pluralized-package
Fixes: https://issues.guix.gnu.org/44675
* guix/lint.scm: Check for occurances of "This packages" in package
descriptions.
* tests/lint.scm: Add test.
---
guix/lint.scm | 9 +++++++++
tests/lint.scm | 7 +++++++
2 files changed, 16 insertions(+)
diff --git a/guix/lint.scm b/guix/lint.scm
index 1bebfe03d3..ffeac18077 100644
--- a/guix/lint.scm
+++ b/guix/lint.scm
@@ -221,6 +221,14 @@ markup is valid return a plain-text version of
DESCRIPTION, otherwise #f."
(G_ "Texinfo markup in description is invalid")
#:field 'description))))
+ (define (check-pluralized-this-package description)
+ "Check that DESCRIPTION does not contain This packages"
+ (if (string-match "This packages" description)
+ (list
+ (make-warning package
+ (G_ "description contains This Packages but should just
be This package")))
+ '()))
+
(define (check-trademarks description)
"Check that DESCRIPTION does not contain '™' or '®' characters. See
http://www.gnu.org/prep/standards/html_node/Trademarks.html."
@@ -283,6 +291,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}")
(check-not-empty description)
(check-quotes description)
(check-trademarks description)
+ (check-pluralized-this-package description)
;; 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 a2c8665142..6cb7a98686 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -160,6 +160,13 @@
(description "This is a 'quoted' thing."))))
(check-description-style pkg))))
+(test-equal "description: pluralized this package"
+ "description contains This Packages but should just be This package"
+ (single-lint-warning-message
+ (let ((pkg (dummy-package "x"
+ (description "This packages is a typo."))))
+ (check-description-style pkg))))
+
(test-equal "synopsis: not a string"
"invalid synopsis: #f"
(single-lint-warning-message
--
2.30.2
signature.asc
Description: PGP signature
- bug#44675: guix lint: support for spellchecker or basic grammar,
Vagrant Cascadian <=