[SCM] Debian package checker branch, master, updated. 2.2.15-7-gc5d215a
The following commit has been merged in the master branch:
commit b7a2e8b3dc4916ddb9a1d15a1e81b1e0b1d1a84e
Author: Raphael Geissert <atomo64@gmail.com>
Date: Mon Sep 14 13:57:53 2009 -0500
Check for spelling errors in the tag description
diff --git a/lib/Spelling.pm b/lib/Spelling.pm
index 7184e18..574ff26 100644
--- a/lib/Spelling.pm
+++ b/lib/Spelling.pm
@@ -579,20 +579,28 @@ sub spelling_check {
my ($tag, $text, $filename) = @_;
return unless $text;
+ my $counter = 0;
+
$text = lc $text;
$text =~ s/[()[\]]//g;
for my $word (split(/\s+/, $text)) {
$word =~ s/[.,;:?!]+$//;
if (exists $CORRECTIONS{$word}) {
- _tag($tag, $filename, $word, $CORRECTIONS{$word});
+ $counter++;
+ _tag($tag, $filename, $word, $CORRECTIONS{$word})
+ if defined $tag;
}
}
# Special case for correcting a multi-word string.
if ($text =~ m,debian/gnu\s+linux,) {
- _tag($tag, $filename, "Debian/GNU Linux", "Debian GNU/Linux");
+ $counter++;
+ _tag($tag, $filename, "Debian/GNU Linux", "Debian GNU/Linux")
+ if defined $tag;
}
+
+ return $counter;
}
# Check spelling of $text against pickier corrections, such as common
@@ -604,10 +612,14 @@ sub spelling_check {
sub spelling_check_picky {
my ($tag, $text, $filename) = @_;
+ my $counter = 0;
+
# Check this first in case it's contained in square brackets and
# removed below.
if ($text =~ m,meta\s+package,) {
- _tag($tag, $filename, "meta package", "metapackage");
+ $counter++;
+ _tag($tag, $filename, "meta package", "metapackage")
+ if defined $tag;
}
# Exclude text enclosed in square brackets as it could be a package list
@@ -617,10 +629,14 @@ sub spelling_check_picky {
for my $word (split(/\s+/, $text)) {
$word =~ s/^\(|[).,?!:;]+$//g;
if (exists $CORRECTIONS_CASE{$word}) {
- _tag($tag, $filename, $word, $CORRECTIONS_CASE{$word});
+ $counter++;
+ _tag($tag, $filename, $word, $CORRECTIONS_CASE{$word})
+ if defined $tag;
next;
}
}
+
+ return $counter;
}
1;
diff --git a/t/scripts/tags.t b/t/scripts/tags.t
index 2fac0ad..82a14e1 100755
--- a/t/scripts/tags.t
+++ b/t/scripts/tags.t
@@ -23,6 +23,7 @@ use warnings;
use Test::More qw(no_plan);
use Util qw(read_dpkg_control);
use Tags ();
+use Spelling;
my @DESCS = <$ENV{'LINTIAN_ROOT'}/checks/*.desc>;
@@ -38,9 +39,13 @@ for my $desc_file (@DESCS) {
ok(exists $i->{'info'}, "Tag has info")
or diag("$desc_file: $i->{'tag'}\n");
+ my $info = $i->{'info'} || '';
+
+ is(spelling_check(undef, $info), 0,
+ "$desc_file: $i->{'tag'} has no spelling errors");
+
# Check the tag info for unescaped <> or for unknown tags (which
# probably indicate the same thing).
- my $info = $i->{'info'} || '';
my @tags;
while ($info =~ s,<([^\s>]+)(?:\s+href=\"[^\"]+\")?>.*?</\1>,,s) {
push (@tags, $1);
--
Debian package checker
Reply to: