* [PATCH 4/5] guix: lint: Check for empty synopses and descriptions.
@ 2014-10-24 5:06 Eric Bavier
2014-10-24 11:57 ` Cyril Roelandt
0 siblings, 1 reply; 3+ messages in thread
From: Eric Bavier @ 2014-10-24 5:06 UTC (permalink / raw)
To: Guix-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: 0004-guix-lint-Check-for-empty-synopses-and-descriptions.patch --]
[-- Type: text/x-diff, Size: 3625 bytes --]
From 94794a8cb470238f60db977b7640202517d379c4 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Wed, 22 Oct 2014 13:48:55 -0500
Subject: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions.
* guix/scripts/lint.scm (check-description-style,
check-synopsis-style): New emptiness checks.
* tests/lint.scm: Test them.
---
guix/scripts/lint.scm | 14 ++++++++++++++
tests/lint.scm | 18 ++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index e8cc853..95eaee3 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -82,6 +82,12 @@
(define (check-description-style package)
;; Emit a warning if stylistic issues are found in the description of PACKAGE.
+ (define (check-not-empty description)
+ (when (string-null? description)
+ (emit-warning package
+ "description should not be empty"
+ 'description)))
+
(define (check-starts-with-upper-case description)
(unless (start-with-capital-letter? description)
(emit-warning package
@@ -110,6 +116,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}"
(let ((description (package-description package)))
(when (string? description)
(begin
+ (check-not-empty description)
(check-starts-with-upper-case description)
(check-end-of-sentence-space description)))))
@@ -128,6 +135,12 @@ by two spaces; possible infraction~p at ~{~a~^, ~}"
(define (check-synopsis-style package)
;; Emit a warning if stylistic issues are found in the synopsis of PACKAGE.
+ (define (check-not-empty synopsis)
+ (when (string-null? synopsis)
+ (emit-warning package
+ "synopsis should not be empty"
+ 'synopsis)))
+
(define (check-final-period synopsis)
;; Synopsis should not end with a period, except for some special cases.
(when (and (string-suffix? "." synopsis)
@@ -165,6 +178,7 @@ by two spaces; possible infraction~p at ~{~a~^, ~}"
(let ((synopsis (package-synopsis package)))
(if (string? synopsis)
(begin
+ (check-not-empty synopsis)
(check-synopsis-start-upper-case synopsis)
(check-final-period synopsis)
(check-start-article synopsis)
diff --git a/tests/lint.scm b/tests/lint.scm
index 2c2a179..8ff32ee 100644
--- a/tests/lint.scm
+++ b/tests/lint.scm
@@ -44,6 +44,15 @@
(thunk))
(get-output-string port)))
+(test-assert "description: not empty"
+ (->bool
+ (string-contains (call-with-warnings
+ (lambda ()
+ (let ((pkg (dummy-package "x"
+ (description ""))))
+ (check-description-style pkg))))
+ "description should not be empty")))
+
(test-assert "description: does not start with an upper-case letter"
(->bool
(string-contains (call-with-warnings
@@ -62,6 +71,15 @@
(check-description-style pkg))))
"sentences in description should be followed by two spaces")))
+(test-assert "synopsis: not empty"
+ (->bool
+ (string-contains (call-with-warnings
+ (lambda ()
+ (let ((pkg (dummy-package "x"
+ (synopsis ""))))
+ (check-synopsis-style pkg))))
+ "synopsis should not be empty")))
+
(test-assert "synopsis: does not start with an upper-case letter"
(->bool
(string-contains (call-with-warnings
--
1.7.9.5
[-- Attachment #2: Type: text/plain, Size: 17 bytes --]
--
Eric Bavier
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions.
2014-10-24 5:06 [PATCH 4/5] guix: lint: Check for empty synopses and descriptions Eric Bavier
@ 2014-10-24 11:57 ` Cyril Roelandt
2014-10-25 16:14 ` Eric Bavier
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Roelandt @ 2014-10-24 11:57 UTC (permalink / raw)
To: guix-devel
On 10/24/2014 07:06 AM, Eric Bavier wrote:
> From 94794a8cb470238f60db977b7640202517d379c4 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Wed, 22 Oct 2014 13:48:55 -0500
> Subject: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions.
>
> * guix/scripts/lint.scm (check-description-style,
> check-synopsis-style): New emptiness checks.
> * tests/lint.scm: Test them.
> ---
> guix/scripts/lint.scm | 14 ++++++++++++++
> tests/lint.scm | 18 ++++++++++++++++++
> 2 files changed, 32 insertions(+)
Should we also check for descriptions that are just #f ? There are a few
valid cases, but in general, it's an issue. WDYT ?
Cyril.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions.
2014-10-24 11:57 ` Cyril Roelandt
@ 2014-10-25 16:14 ` Eric Bavier
0 siblings, 0 replies; 3+ messages in thread
From: Eric Bavier @ 2014-10-25 16:14 UTC (permalink / raw)
To: Cyril Roelandt; +Cc: guix-devel
Cyril Roelandt writes:
> On 10/24/2014 07:06 AM, Eric Bavier wrote:
>> From 94794a8cb470238f60db977b7640202517d379c4 Mon Sep 17 00:00:00 2001
>> From: Eric Bavier <bavier@member.fsf.org>
>> Date: Wed, 22 Oct 2014 13:48:55 -0500
>> Subject: [PATCH 4/5] guix: lint: Check for empty synopses and descriptions.
>>
>> * guix/scripts/lint.scm (check-description-style,
>> check-synopsis-style): New emptiness checks.
>> * tests/lint.scm: Test them.
>> ---
>> guix/scripts/lint.scm | 14 ++++++++++++++
>> tests/lint.scm | 18 ++++++++++++++++++
>> 2 files changed, 32 insertions(+)
>
>
> Should we also check for descriptions that are just #f ? There are a few
> valid cases, but in general, it's an issue. WDYT ?
We may want to. I think what we're trying to catch is the case where a
developer initially put a placeholder in, but might have forgotten to go
back fill the field in with a proper string. Depending on the
developer's taste, the placeholder might be an empty string, or #f.
I'll try out the #f check, and see if it runs into any problems.
--
Eric Bavier
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-10-25 16:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24 5:06 [PATCH 4/5] guix: lint: Check for empty synopses and descriptions Eric Bavier
2014-10-24 11:57 ` Cyril Roelandt
2014-10-25 16:14 ` Eric Bavier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.