Commit 912e7347 authored by Chris Lamb's avatar Chris Lamb

Make the file-contains-trailing-whitespace tag also emit for whitespace at end of files.

parent 1fdea3bb
......@@ -905,9 +905,9 @@ Info: This file appears to contain one or more lines with trailing
.
Whilst typically harmless and merely unsightly, they can often cause
difficult-to-spot issues where tools interpret the whitespace characters
literally and are thus best avoided in their entirity.
literally. They are thus best avoided in their entirity.
.
Whitespace can be removed with the following code snippet:
Whitespace at the end of lines may be removed with the following:
.
$ sed -i -e 's@[[:space:]]*$@@g' debian/control debian/changelog
.
......@@ -917,6 +917,10 @@ Info: This file appears to contain one or more lines with trailing
(eg. for Makefiles), you can use the following code snippet:
.
$ sed -i -e 's@[ ]*$@@g' debian/rules
.
To remove empty lines from the end of a file, you can use:
.
$ sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' debian/rules
Tag: autotools-pkg-config-macro-not-cross-compilation-safe
Severity: normal
......
......@@ -397,11 +397,20 @@ sub run {
my $path = $info->index_resolved_path($file->[0]);
next if not $path or not $path->is_open_ok;
my $fd = $path->open;
my @empty_lines;
while (my $line = <$fd>) {
if ($line eq "\n") {
push @empty_lines, $.;
next;
}
@empty_lines = (); # reset; line is not empty
tag 'file-contains-trailing-whitespace', "$path (line $.)"
if ($line =~ $file->[1]);
}
close($fd);
for my $num (@empty_lines) {
tag 'file-contains-trailing-whitespace', "$path (line $num)";
}
}
if (my $pycompat = $info->index_resolved_path('debian/pycompat')) {
......
......@@ -10,6 +10,8 @@ lintian (2.5.85) UNRELEASED; urgency=medium
+ [CL] Include the offending version numbers in the output of the
non-consecutive-debian-revision tag.
* checks/cruft.pm:
+ [CL] Make the file-contains-trailing-whitespace tag also emit for
whitespace at end of files.
+ [CL] Drop now-misleading comment regarding trailing whitespace
filenames being relative.
* checks/description.pm:
......
......@@ -19,4 +19,3 @@ Description: {$description}
Note there is an explicitly pre-depends on multiarch-support, since
older versions of debhelper might not use it yet. dpkg-dev will
remove the duplicate entry (if any).
......@@ -241,4 +241,3 @@ Description: checks use of old FSF address
Lintian. It is part of the Lintian test suite and may do very odd
things. It should not be installed like a regular package. It may
be an empty package.
......@@ -12,4 +12,3 @@ override_dh_installdocs:
# This should (now) trigger a no-copyright-file (as there is no copyright file
# in the right location).
mv debian/copyright-old-style/usr/share/doc/copyright-old-style/copyright debian/copyright-old-style/usr/doc/copyright/copyright-old-style
......@@ -3,3 +3,4 @@ cruft-file-contains-trailing-whitespace for Debian
This line does not contain any trailing whitespace.
This line contains a trailing whitespace character but is still a false-positive as we ignore README.source.
......@@ -5,3 +5,5 @@
* Suppress "should close ITP bug" messages. (Closes: #123456)
-- {$author} {$date}
......@@ -4,3 +4,4 @@
dh $@
# The line contains a trailing tab (false-positive)
P: cruft-file-contains-trailing-whitespace source: file-contains-trailing-whitespace debian/changelog (line 3)
P: cruft-file-contains-trailing-whitespace source: file-contains-trailing-whitespace debian/changelog (line 8)
P: cruft-file-contains-trailing-whitespace source: file-contains-trailing-whitespace debian/changelog (line 9)
P: cruft-file-contains-trailing-whitespace source: file-contains-trailing-whitespace debian/rules (line 7)
......@@ -31,4 +31,3 @@ Description: {$description} (unknown profile)
Lintian. It is part of the Lintian test suite and may do very odd
things. It should not be installed like a regular package. It may
be an empty package.
......@@ -3,4 +3,3 @@ generic-dh-make-2008 (1.0-1) unstable; urgency=low
* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
-- Russ Allbery <rra@debian.org> Mon, 29 Dec 2008 17:33:59 -0800
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment