unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH 1/5] guix: lint: Use string-suffix? and string-prefix? where appropriate.
@ 2014-10-24  5:04 Eric Bavier
  2014-10-24 10:47 ` Cyril Roelandt
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Bavier @ 2014-10-24  5:04 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: 0001-guix-lint-Use-string-suffix-and-string-prefix-where-.patch --]
[-- Type: text/x-diff, Size: 2481 bytes --]

From b3b98226891164cf274d97b339b8f2cbc69f95d8 Mon Sep 17 00:00:00 2001
From: Eric Bavier <bavier@member.fsf.org>
Date: Wed, 22 Oct 2014 09:20:20 -0500
Subject: [PATCH 1/5] guix: lint: Use string-suffix? and string-prefix? where
 appropriate.

* guix/scripts/lint.scm (check-synopsis): Use string-suffix? and
  string-prefix? in place of string-take and string=?.
---
 guix/scripts/lint.scm |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/guix/scripts/lint.scm b/guix/scripts/lint.scm
index 5c1ea36..be866ab 100644
--- a/guix/scripts/lint.scm
+++ b/guix/scripts/lint.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
+;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -103,15 +104,15 @@
   ;; Emit a warning if stylistic issues are found in the synopsis of PACKAGE.
   (define (check-final-period synopsis)
     ;; Synopsis should not end with a period, except for some special cases.
-    (if (and (string=? (string-take-right synopsis 1) ".")
-             (not (string=? (string-take-right synopsis 4) "etc.")))
+    (if (and (string-suffix? "." synopsis)
+             (not (string-suffix? "etc." synopsis)))
         (emit-warning package
                       "no period allowed at the end of the synopsis"
                       'synopsis)))
 
   (define (check-start-article synopsis)
-   (if (or (string-ci=? (string-take synopsis 2) "A ")
-           (string-ci=? (string-take synopsis 3) "An "))
+    (if (or (string-prefix-ci? "A " synopsis)
+            (string-prefix-ci? "An " synopsis))
        (emit-warning package
                      "no article allowed at the beginning of the synopsis"
                      'synopsis)))
@@ -130,12 +131,10 @@
                    'synopsis)))
 
   (define (check-start-with-package-name synopsis)
-   (let ((idx (string-contains-ci synopsis (package-name package))))
-     (when (and idx
-                (= idx 0))
-       (emit-warning package
-                     "synopsis should not start with the package name")
-                     'synopsis)))
+    (when (string-prefix-ci? (package-name package) synopsis)
+      (emit-warning package
+                    "synopsis should not start with the package name"
+                    'synopsis)))
 
  (let ((synopsis (package-synopsis package)))
    (if (string? synopsis)
-- 
1.7.9.5


[-- Attachment #2: Type: text/plain, Size: 17 bytes --]


-- 
Eric Bavier

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/5] guix: lint: Use string-suffix? and string-prefix? where appropriate.
  2014-10-24  5:04 [PATCH 1/5] guix: lint: Use string-suffix? and string-prefix? where appropriate Eric Bavier
@ 2014-10-24 10:47 ` Cyril Roelandt
  0 siblings, 0 replies; 2+ messages in thread
From: Cyril Roelandt @ 2014-10-24 10:47 UTC (permalink / raw)
  To: guix-devel

On 10/24/2014 07:04 AM, Eric Bavier wrote:
> From b3b98226891164cf274d97b339b8f2cbc69f95d8 Mon Sep 17 00:00:00 2001
> From: Eric Bavier <bavier@member.fsf.org>
> Date: Wed, 22 Oct 2014 09:20:20 -0500
> Subject: [PATCH 1/5] guix: lint: Use string-suffix? and string-prefix? where
>  appropriate.
> 
> * guix/scripts/lint.scm (check-synopsis): Use string-suffix? and
>   string-prefix? in place of string-take and string=?.
> ---
>  guix/scripts/lint.scm |   19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)

Looks good to me.

Cyril.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-24 10:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-24  5:04 [PATCH 1/5] guix: lint: Use string-suffix? and string-prefix? where appropriate Eric Bavier
2014-10-24 10:47 ` Cyril Roelandt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).