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

[lintian] 01/02: Rewrite file-contains-trailing-whitespace tag to be hash from filename to the regex we should match.



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

lamby pushed a commit to branch master
in repository lintian.

commit bd1f02ef6b06ba6a8e53027b64b885e0c7ebced0
Author: Chris Lamb <lamby@debian.org>
Date:   Wed Nov 1 12:36:31 2017 +0100

    Rewrite file-contains-trailing-whitespace tag to be hash from filename to the regex we should match.
---
 checks/cruft.pm  | 10 +++++++---
 debian/changelog |  3 +++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/checks/cruft.pm b/checks/cruft.pm
index 45ccd7f..ae5a52f 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -326,7 +326,11 @@ our @EOL_TERMINATORS_FILES = qw(control changelog);
 
 # List of files to check for a trailing whitespace characters relative
 # to the debian/ source directory
-our @TRAILING_WHITESPACE_FILES = qw(control rules changelog);
+our @TRAILING_WHITESPACE_FILES = (
+    ['debian/changelog'        => qr,\s+\n$,],
+    ['debian/control'          => qr,\s+\n$,],
+    ['debian/rules'            => qr,\s+\n$,],
+);
 
 sub run {
     my (undef, undef, $info, $proc) = @_;
@@ -382,12 +386,12 @@ sub run {
     }
 
     for my $file (@TRAILING_WHITESPACE_FILES) {
-        my $path = $info->index_resolved_path("debian/$file");
+        my $path = $info->index_resolved_path($file->[0]);
         next if not $path or not $path->is_open_ok;
         my $fd = $path->open;
         while (my $line = <$fd>) {
             tag 'file-contains-trailing-whitespace', "$path (line $.)"
-              if ($line =~ m/\s+\n$/);
+              if ($line =~ $file->[1]);
         }
         close($fd);
     }
diff --git a/debian/changelog b/debian/changelog
index 5cce98e..d8bae89 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,9 @@ lintian (2.5.58) UNRELEASED; urgency=medium
 
   XXX: generate tag summary
 
+  * checks/cruft.pm
+    + [CL] Rewrite file-contains-trailing-whitespace tag to be hash from
+      filename to the regex we should match.
   * checks/fields.desc:
     + [SL] Update of the documentation for the change introduced in 2.5.53:
       Transitional packages should now be "oldlibs/optional" rather

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


Reply to: