[lintian] 01/01: Warn about certain files under debian/* that contain trailing whitespace characters. (Closes: #748405)
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 986c8926202cfc8322b7f6f8fb13cd32c6e44def
Author: Chris Lamb <lamby@debian.org>
Date: Wed Oct 25 16:32:58 2017 -0400
Warn about certain files under debian/* that contain trailing whitespace characters. (Closes: #748405)
---
checks/cruft.desc | 10 ++++++++++
checks/cruft.pm | 15 +++++++++++++++
debian/changelog | 3 +++
.../debian/debian/README.source | 5 +++++
t/tests/cruft-file-contains-trailing-whitespace/desc | 6 ++++++
t/tests/cruft-file-contains-trailing-whitespace/tags | 0
6 files changed, 39 insertions(+)
diff --git a/checks/cruft.desc b/checks/cruft.desc
index e394856..14eae5f 100644
--- a/checks/cruft.desc
+++ b/checks/cruft.desc
@@ -889,3 +889,13 @@ Info: This file appears to be incomplete or insufficiently modified as it
.
Please double-check the file and replace the placeholder with the required
command or information.
+
+Tag: file-contains-trailing-whitespace
+Severity: wishlist
+Certainty: certain
+Info: This file appears to contain one or more lines with trailing
+ whitespace characters.
+ .
+ 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.
diff --git a/checks/cruft.pm b/checks/cruft.pm
index 83c30ae..e11f0f2 100644
--- a/checks/cruft.pm
+++ b/checks/cruft.pm
@@ -324,6 +324,10 @@ my @file_checks = (
# to the debian/ source directory
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 README.source);
+
sub run {
my (undef, undef, $info, $proc) = @_;
my $source_pkg = $proc->pkg_src;
@@ -377,6 +381,17 @@ sub run {
close($fd);
}
+ for my $file (@TRAILING_WHITESPACE_FILES) {
+ my $path = $info->index_resolved_path("debian/$file");
+ 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$/);
+ }
+ close($fd);
+ }
+
if (my $pycompat = $info->index_resolved_path('debian/pycompat')) {
tag 'debian-pycompat-is-obsolete' if $pycompat->is_file;
}
diff --git a/debian/changelog b/debian/changelog
index 35973ed..9c5f0b1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,9 @@ lintian (2.5.56) UNRELEASED; urgency=medium
number of spelling mistakes. (Closes: #878446)
+ [CL] Apply patch from Ville Skyttä <ville.skytta@iki.fi> to update
a number of manual references. (Closes: #878517)
+ * checks/cruft.{pm,desc}:
+ + [CL] Warn about certain files under debian/* that contain trailing
+ whitespace characters. (Closes: #748405)
* checks/debconf.desc:
+ [CL] Apply patch from Ville Skyttä <ville.skytta@iki.fi> to update
the debconf-spec refs. (Closes: #878449)
diff --git a/t/tests/cruft-file-contains-trailing-whitespace/debian/debian/README.source b/t/tests/cruft-file-contains-trailing-whitespace/debian/debian/README.source
new file mode 100644
index 0000000..93caf69
--- /dev/null
+++ b/t/tests/cruft-file-contains-trailing-whitespace/debian/debian/README.source
@@ -0,0 +1,5 @@
+cruft-file-contains-trailing-whitespace for Debian
+--------------------------------------------------
+
+This line does not contain any trailing whitespace.
+This line contains a trailing whitespace character.
diff --git a/t/tests/cruft-file-contains-trailing-whitespace/desc b/t/tests/cruft-file-contains-trailing-whitespace/desc
new file mode 100644
index 0000000..056ddb6
--- /dev/null
+++ b/t/tests/cruft-file-contains-trailing-whitespace/desc
@@ -0,0 +1,6 @@
+Testname: cruft-file-contains-trailing-whitespace
+Version: 1.0
+Description: Check for files containing trailing whitespace characters
+Options: -I -E --pedantic
+Test-For:
+ file-contains-trailing-whitespace
diff --git a/t/tests/cruft-file-contains-trailing-whitespace/tags b/t/tests/cruft-file-contains-trailing-whitespace/tags
new file mode 100644
index 0000000..e69de29
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: