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

[SCM] Debian package checker branch, master, updated. 2.5.11-191-g02d6e5b



The following commit has been merged in the master branch:
commit 02d6e5b09526d54272f5727f1aa29f18c7046696
Author: Niels Thykier <niels@thykier.net>
Date:   Tue Mar 26 20:45:14 2013 +0100

    L::Tag::Info: Improve error message on bad severity/certain
    
    Signed-off-by: Niels Thykier <niels@thykier.net>

diff --git a/debian/changelog b/debian/changelog
index e6478c4..cba6a83 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -225,6 +225,8 @@ lintian (2.5.12) UNRELEASED; urgency=low
   * lib/Lintian/Tag/Info.pm:
     + [NT] Use "&amp;" in the manpage ref URLs to generate proper HTML.
       Thanks to Vasudev Kamath for reporting the issue.
+    + [NT] Produce a more helpful error message when a tag has an
+      invalid severity or certain.  (Closes: #703978)
   * lib/Lintian/Tags.pm:
     + [NT] Deal with parsing an ambigious override a bit better.  This
       solves false-positive malformed-override, where Lintian misparsed
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index c74b165..3c6ff4b 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -26,6 +26,7 @@ use Carp qw(croak);
 
 use Lintian::Data;
 use Lintian::Tag::TextUtil qw(dtml_to_html dtml_to_text split_paragraphs wrap_paragraphs);
+use Lintian::Tags qw();
 use Lintian::Util qw(fail);
 
 # The URL to a web man page service.  NAME is replaced by the man page
@@ -89,6 +90,12 @@ sub new {
     $tagname = $self->{'tag'};
     croak "Missing Severity field for $tagname" unless $self->{'severity'};
     croak "Missing Certainty field for $tagname" unless $self->{'certainty'};
+    croak "Tag $tagname has invalid severity ($self->{'severity'}):"
+          . ' Must be one of ' . join (', ', @Lintian::Tags::SEVERITIES)
+        unless exists $CODES{$self->{'severity'}};
+    croak "Tag $tagname has invalid certainty ($self->{'certainty'}):"
+          . ' Must be one of ' . join (', ', @Lintian::Tags::CERTAINTIES)
+        unless exists $CODES{$self->{'severity'}}{$self->{'certainty'}};
     $self->{'info'} = '' unless $self->{'info'};
     $self->{'script'} = $sn;
     $self->{'script-type'} = $st;
@@ -96,14 +103,6 @@ sub new {
 
     bless $self, $class;
 
-    # Check the tag has a code - if it doesn't, either the severity or
-    # certainty is wrong (or we introduced a new one but forgot to add
-    # it to %CODES).
-    unless ($self->code) {
-        croak "Cannot determine the code of $tagname (severity:"
-            . " $self->{'severity'}, certainity: $self->{'certainty'}).\n";
-    }
-
     return $self;
 }
 

-- 
Debian package checker


Reply to: