[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[lintian] 06/06: Do ligth weight cleaning in gfdl



This is an automated email from the git hooks/post-receive script.

broucaries-guest pushed a commit to branch master
in repository lintian.

commit de64040ff527ab164ac6d4eff495f64b4126763d
Author: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Date:   Tue Feb 25 12:09:14 2014 +0100

    Do ligth weight cleaning in gfdl
    
    Do not reclean but trim punctuation.
    
    Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
---
 checks/cruft.pm | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/checks/cruft.pm b/checks/cruft.pm
index bbbda2a..4afb997 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -704,9 +704,9 @@ sub license_check {
                     my $rawgfdlsections  = $+{rawgfdlsections}  || '';
                     my $rawcontextbefore = $+{rawcontextbefore} || '';
 
-                    # replace some common comment-marker/markup with space
-                    my $gfdlsections  = _clean_block($rawgfdlsections);
-                    my $contextbefore = _clean_block($rawcontextbefore);
+                    # strip puntuation
+                    my $gfdlsections  = _strip_punct($rawgfdlsections);
+                    my $contextbefore = _strip_punct($rawcontextbefore);
 
                     # remove classical and without meaning part of
                     # matched string
@@ -865,8 +865,6 @@ sub _clean_block {
                   \\n                          |  # Verbatim \n in string array
                   \\&                          |  # pod2man formating
                   \\s(?:0|-1)                  |  # pod2man formating
-                  \s*[,\.;]\s*\Z               |  # final punctuation
-                  \A\s*[,\.;]\s*               |  # punctuation at the beginning
                   (?:``|'')                    |  # quote like
                   [%\*\"\|\\\#]                   # String, C-style comment/javadoc indent,
                                                   # quotes for strings, pipe and antislash in some txt
@@ -881,6 +879,23 @@ sub _clean_block {
     return $text;
 }
 
+# strip punctuation at both ends
+sub _strip_punct() {
+    my ($text) = @_;
+    # replace final punctuation
+    $text =~ s{(?:
+        \s*[,\.;]\s*\Z               |  # final punctuation
+        \A\s*[,\.;]\s*                  # punctuation at the beginning
+    )}{ }gxms;
+
+    # delete double spacing now and normalize spacing
+    # to space character
+    $text =~ s{\s++}{ }gsm;
+    strip($text);
+
+    return $text;
+}
+
 sub lc_block {
     return $_ = lc($_);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: