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

[SCM] Debian package checker branch, master, updated. 2.2.18-55-g8d8221a



The following commit has been merged in the master branch:
commit 8d8221a82c65a1725bfce715e73e3e68bf42b133
Author: Russ Allbery <rra@debian.org>
Date:   Thu Dec 24 16:35:59 2009 -0800

    Better handle uppercase words in spelling checks
    
    * checks/binaries.desc:
      + [RA] Spelling errors are no longer normalized to lowercase.
    * lib/Spelling.pm:
      + [RA] Ignore all-caps words of five characters or less for spelling
        corrections, since they are probably acronyms.  Thanks, Michal
        Čihař.  (Closes: #556456)
      + [RA] Report the original word in spelling errors rather than the
        normalized form.

diff --git a/checks/binaries.desc b/checks/binaries.desc
index 07cd24e..fcc49fc 100644
--- a/checks/binaries.desc
+++ b/checks/binaries.desc
@@ -223,8 +223,7 @@ Severity: minor
 Certainty: wild-guess
 Info: Lintian found a spelling error in the given binary.  Lintian has a
  list of common misspellings that it looks for.  It does not have a
- dictionary like a spelling checker does.  For Lintian's convenience all
- words are normalised to lower case.
+ dictionary like a spelling checker does.
  .
  If the string containing the spelling error is translated with the help
  of gettext or a similar tool, please fix the error in the translations as
@@ -232,13 +231,9 @@ Info: Lintian found a spelling error in the given binary.  Lintian has a
  gettext, for example, this means you should also fix the spelling mistake
  in the corresponding msgids in the *.po files.
  .
- To find the original word you can run:
- .
-  strings &lt;binary&gt; | grep -i &lt;word&gt;
- .
  You can often find the word in the source code by running:
  .
-  grep -r '\b&lt;original-word&gt;\b' &lt;source-tree&gt;
+  grep -rw &lt;word&gt; &lt;source-tree&gt;
 
 Tag: embedded-zlib
 Severity: serious
diff --git a/debian/changelog b/debian/changelog
index be54253..bd743e2 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -8,12 +8,13 @@ lintian (2.3.0) UNRELEASED; urgency=low
 
   * checks/*:
     + [RA] Use Lintian::Tags instead of Tags.
-  * checks/binaries:
+  * checks/binaries{,.desc}:
     + [RA] Allow any RPATH containing $ORIGIN or ${ORIGIN}, not just the
       literal value $ORIGIN.  (Closes: #557511)
     + [ADB] Exempt all binary packages built from the zlib source from
       the embedded-zlib test, not just those with binary package names
       matching zlib.+.  Thanks, Mark Brown.
+    + [RA] Spelling errors are no longer normalized to lowercase.
   * checks/changelog-file:
     + [RA] Suppress latest-debian-changelog-entry-without-new-date if the
       distribution is UNRELEASED.  Thanks, Raphaël Hertzog.
@@ -106,6 +107,11 @@ lintian (2.3.0) UNRELEASED; urgency=low
       closing tag in the experimental XML output.
   * lib/Spelling.pm:
     + [RA] Use Lintian::Tags instead of Tags.
+    + [RA] Ignore all-caps words of five characters or less for spelling
+      corrections, since they are probably acronyms.  Thanks, Michal
+      Čihař.  (Closes: #556456)
+    + [RA] Report the original word in spelling errors rather than the
+      normalized form.
   * lib/Tags.pm:
     + [RA] Removed in favor of Lintian::Tags.
   * lib/Util.pm:
diff --git a/lib/Spelling.pm b/lib/Spelling.pm
index 389ceef..62692fa 100644
--- a/lib/Spelling.pm
+++ b/lib/Spelling.pm
@@ -583,15 +583,19 @@ sub spelling_check {
 
     my $counter = 0;
 
-    $text = lc $text;
     $text =~ s/[()[\]]//g;
 
     for my $word (split(/\s+/, $text)) {
         $word =~ s/[.,;:?!]+$//;
-        if (exists $CORRECTIONS{$word}) {
+        next if (length($word) <= 5 and $word =~ /^[A-Z]+\z/);
+        my $lcword = lc $word;
+        if (exists $CORRECTIONS{$lcword}) {
             $counter++;
-            _tag($tag, $filename, $word, $CORRECTIONS{$word})
-                if defined $tag;
+            my $correction = $CORRECTIONS{$lcword};
+            if ($word =~ /^[A-Z]/) {
+                $correction = ucfirst $correction;
+            }
+            _tag($tag, $filename, $word, $correction) if defined $tag;
         }
     }
 
diff --git a/t/COVERAGE b/t/COVERAGE
index 29d1923..e278fd2 100644
--- a/t/COVERAGE
+++ b/t/COVERAGE
@@ -1,4 +1,4 @@
-Last generated 2009-12-24
+Last generated 2009-12-25
 
 The following tags are not tested by the test suite:
 
@@ -45,8 +45,6 @@ debconf select-without-choices
 debconf unknown-field-in-templates
 debconf unknown-template-type
 
-debian-readme spelling-error-in-readme-debian
-
 fields alternates-not-allowed
 fields arch-any-in-binary-pkg
 fields aspell-package-not-arch-all
@@ -285,9 +283,6 @@ debconf using-question-in-extended-description-in-templates
 
 debhelper uses-dh-python-with-no-pycompat
 
-debian-readme readme-debian-contains-debmake-default-email-address
-debian-readme readme-debian-mentions-usr-doc
-
 etcfiles file-in-etc-not-marked-as-conffile
 
 fields bad-version-in-relation
@@ -668,7 +663,6 @@ etcfiles
   malformed-md5sums-control-file
   md5sum-mismatch
   md5sums-lists-nonexisting-file
-  readme-debian-mentions-usr-doc
   run-parts-cron-filename-contains-full-stop
 
 fields
@@ -724,7 +718,6 @@ foo++
   debian-watch-file-in-native-package
   latest-debian-changelog-entry-without-new-date
   malformed-dm-upload-allowed
-  readme-debian-contains-debmake-default-email-address
   uploader-address-is-on-localhost
   uploader-address-looks-weird
   uploader-address-malformed
diff --git a/t/tests/debian-readme-general/debian/debian/README.Debian b/t/tests/debian-readme-general/debian/debian/README.Debian
new file mode 100644
index 0000000..482b668
--- /dev/null
+++ b/t/tests/debian-readme-general/debian/debian/README.Debian
@@ -0,0 +1,11 @@
+This is a test README.Debian with a few problems that Lintian should
+catch, like accidentaly misspelled words.
+
+Here is a reference to /usr/doc/debian-readme-general, which is an old
+path that nothing should use any more.
+
+ALS is not a spelling error for also and ANG is not a spelling error for
+and.  In general, possible acronyms like COMIT should be ignored.  But
+only to a certain length; CHNAGES is still wrong.
+
+ -- Unknown <unknown@unknown>
diff --git a/t/tests/debian-readme-general/desc b/t/tests/debian-readme-general/desc
new file mode 100644
index 0000000..b381240
--- /dev/null
+++ b/t/tests/debian-readme-general/desc
@@ -0,0 +1,9 @@
+Testname: debian-readme-general
+Sequence: 6000
+Version: 1.0
+Description: General tests for README.Debian
+Test-For:
+ readme-debian-contains-debmake-default-email-address
+ readme-debian-mentions-usr-doc
+ spelling-error-in-readme-debian
+References: Debian Bug#556456
diff --git a/t/tests/debian-readme-general/tags b/t/tests/debian-readme-general/tags
new file mode 100644
index 0000000..e37c7b6
--- /dev/null
+++ b/t/tests/debian-readme-general/tags
@@ -0,0 +1,4 @@
+W: debian-readme-general: readme-debian-contains-debmake-default-email-address
+W: debian-readme-general: readme-debian-mentions-usr-doc line 4
+W: debian-readme-general: spelling-error-in-readme-debian CHNAGES Changes
+W: debian-readme-general: spelling-error-in-readme-debian accidentaly accidentally

-- 
Debian package checker


Reply to: