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

[SCM] Debian package checker branch, master, updated. 2.5.4-139-g13dd8d5



The following commit has been merged in the master branch:
commit 13dd8d5e45bb44052d0e9396f2b48e3ac32cec99
Author: Niels Thykier <niels@thykier.net>
Date:   Fri Feb 3 22:26:12 2012 +0100

    Emit spelling tags only once per error per field/file/text
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index 9c02b3b..d4b33eb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -196,6 +196,8 @@ lintian (2.5.5) UNRELEASED; urgency=low
       done reliably anymore.
     + [NT] Applied patch from intrigeri to remove the "not-full-name"
       tags.
+    + [NT] Only emit a spelling tag once for each spelling error in each
+      field/file/text.
   * lib/Lintian/CheckScript.pm:
     + [NT] New file.
   * lib/Lintian/Collect/{Binary,Source}.pm:
diff --git a/lib/Lintian/Check.pm b/lib/Lintian/Check.pm
index 1cd4c44..ceeb65f 100644
--- a/lib/Lintian/Check.pm
+++ b/lib/Lintian/Check.pm
@@ -220,6 +220,7 @@ sub check_spelling {
     my ($tag, $text, $filename, $exceptions) = @_;
     return unless $text;
 
+    my %seen = ();
     my $counter = 0;
     my $corrections = Lintian::Data->new('spelling/corrections', '\|\|');
     my $corrections_multiword =
@@ -243,6 +244,7 @@ sub check_spelling {
             } elsif ($word =~ /^[A-Z]/) {
                 $correction = ucfirst $correction;
             }
+            next if $seen{$lcword}++;
             _tag($tag, $filename, $word, $correction) if defined $tag;
         }
     }
@@ -259,6 +261,7 @@ sub check_spelling {
                 $correction = ucfirst $correction;
             }
             $counter++;
+            next if $seen{lc $word}++;
             _tag($tag, $filename, $word, $correction)
                 if defined $tag;
         }
@@ -283,6 +286,7 @@ Returns the number of spelling mistakes found in TEXT.
 sub check_spelling_picky {
     my ($tag, $text, $filename) = @_;
 
+    my %seen = ();
     my $counter = 0;
     my $corrections_case =
         Lintian::Data->new('spelling/corrections-case', '\|\|');
@@ -303,6 +307,7 @@ sub check_spelling_picky {
         $word =~ s/^\(|[).,?!:;]+$//g;
         if ($corrections_case->known($word)) {
             $counter++;
+            next if $seen{$word}++;
             _tag($tag, $filename, $word, $corrections_case->value($word))
                 if defined $tag;
             next;
diff --git a/t/tests/spelling-general/debian/debian/changelog.in b/t/tests/spelling-general/debian/debian/changelog.in
index c267371..86e5ced 100644
--- a/t/tests/spelling-general/debian/debian/changelog.in
+++ b/t/tests/spelling-general/debian/debian/changelog.in
@@ -5,6 +5,8 @@
 
   * Suppress "should close ITP bug" messages.  (Closes: #123456)
   * This line has a speling error.
+    - This line has the same speling error, but we should only
+      get one tag for it.
   * Corrected spelling: abov -> above.
 
  -- {$author}  {$date}
diff --git a/t/tests/spelling-multiword/debian/debian/control.in b/t/tests/spelling-multiword/debian/debian/control.in
index 7be593e..433699a 100644
--- a/t/tests/spelling-multiword/debian/debian/control.in
+++ b/t/tests/spelling-multiword/debian/debian/control.in
@@ -20,6 +20,7 @@ Description: {$description}
    * Debian/GNU Linux
    * Permits to
    * This packages
+   * This packages (again, but only tagged once)
  .
  Not errors:
    * These packages

-- 
Debian package checker


Reply to: