Patchwork gnu: Remove trademark acknowledgements.

login
register
mail settings
Submitter Eric Bavier
Date Aug. 23, 2016, 3:31 p.m.
Message ID <20160823103109.5b28fafd@openmailbox.org>
Download mbox | patch
Permalink /patch/14878/
State New
Headers show

Comments

Eric Bavier - Aug. 23, 2016, 3:31 p.m.
On Tue, 23 Aug 2016 12:15:17 +0200
Ricardo Wurmus <rekado@elephly.net> wrote:

> Eric Bavier <ericbavier@openmailbox.org> writes:
> 
> > On Mon, 22 Aug 2016 22:03:58 +0200
> > Ricardo Wurmus <rekado@elephly.net> wrote:
> >  
> >> John Darrington <john@darrington.wattle.id.au> writes:
> >>   
> >> > These somehow crept in, but are an explicit violation of GNU policy and
> >> > coding standards.    
> >> 
> >> Good catch!  Thanks for fixing this.
> >> 
> >> ~~ Ricardo  
> >
> > How about the attached patch to catch such things earlier?  
> 
> I like it.  Thanks, Eric!
> 
> Not sure if we should use “for-each” here (going through the string
> once for each character) or if we could just go through the string once,
> checking for any character match.
> 
> Also, should we replace “sign” with “character”?

In this updated patch I addressed both of these concerns.  It's also
about 14% faster (on a single benchmark :).

`~Eric
Ludovic Courtès - Aug. 27, 2016, 10:24 p.m.
Hi!

Eric Bavier <ericbavier@openmailbox.org> skribis:

> From 46a8f3322392fcd6a7641062ff6b3d23685f394b Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Tue, 23 Aug 2016 02:08:02 -0500
> Subject: [PATCH] guix: lint: Check descriptions for trademark signs.
>
> * guix/scripts/lint.scm (check-description-style): Emit a warning if
>   trademark signs found in description.

This is very nice!

Before pushing, could you add a simple test in tests/lint.scm, along the
lines of the others ones that are already there?

Thank you!

Ludo’.
Eric Bavier - Aug. 29, 2016, 4:25 a.m.
On Sun, 28 Aug 2016 00:24:40 +0200
ludo@gnu.org (Ludovic Courtès) wrote:

> Hi!
> 
> Eric Bavier <ericbavier@openmailbox.org> skribis:
> 
> > From 46a8f3322392fcd6a7641062ff6b3d23685f394b Mon Sep 17 00:00:00 2001
> > From: Eric Bavier <bavier@member.fsf.org>
> > Date: Tue, 23 Aug 2016 02:08:02 -0500
> > Subject: [PATCH] guix: lint: Check descriptions for trademark signs.
> >
> > * guix/scripts/lint.scm (check-description-style): Emit a warning if
> >   trademark signs found in description.  
> 
> This is very nice!
> 
> Before pushing, could you add a simple test in tests/lint.scm, along the
> lines of the others ones that are already there?

Done.  Pushed in 83f18e06530f025df9f6c5059bfe261a1291a24f.

`~Eroc

Patch

From 46a8f3322392fcd6a7641062ff6b3d23685f394b Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Tue, 23 Aug 2016 02:08:02 -0500
Subject: [PATCH] guix: lint: Check descriptions for trademark signs.

* guix/scripts/lint.scm (check-description-style): Emit a warning if
  trademark signs found in description.
---
 guix/scripts/lint.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 51191e7..07e46a9 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -161,6 +161,17 @@  markup is valid return a plain-text version of DESCRIPTION, otherwise #f."
                       'description)
         #f)))
 
+  (define (check-trademarks description)
+    "Check that DESCRIPTION does not contain '™' or '®' characters.  See
+http://www.gnu.org/prep/standards/html_node/Trademarks.html."
+    (match (string-index description (char-set #\™ #\®))
+      ((and (? number?) index)
+       (emit-warning package
+                     (format #f (_ "description should not contain ~
+trademark sign '~a' at ~d")
+                             (string-ref description index) index)))
+      (else #t)))
+
   (define (check-proper-start description)
     (unless (or (properly-starts-sentence? description)
                 (string-prefix-ci? (package-name package) description))
@@ -191,6 +202,7 @@  by two spaces; possible infraction~p at ~{~a~^, ~}")
     (if (string? description)
         (begin
           (check-not-empty description)
+          (check-trademarks description)
           ;; Use raw description for this because Texinfo rendering
           ;; automatically fixes end of sentence space.
           (check-end-of-sentence-space description)
-- 
2.9.2