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

[SCM] Debian package checker branch, master, updated. 2.2.18-33-g3cfd89c



The following commit has been merged in the master branch:
commit b6ef86a9e34ea292bf32706a563ba1763a99211d
Author: Russ Allbery <rra@debian.org>
Date:   Sun Dec 20 18:17:43 2009 -0800

    Add code method to Lintian::Tag::Info
    
    * lib/Lintian/Tag/Info.pm:
      + [RA] Add a code method that returns the tag code corresponding to
        the severity and certainty for a tag, based on get_tag_code from
        Tags.pm.

diff --git a/debian/changelog b/debian/changelog
index 9d30443..5c44aae 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -17,6 +17,10 @@ lintian (2.2.19) UNRELEASED; urgency=low
     + [RA] Support comments and blank lines in --tags-from-file files.
     + [RA] Run the check modules in sorted order.
 
+  * lib/Lintian/Tag/Info.pm:
+    + [RA] Add a code method that returns the tag code corresponding to
+      the severity and certainty for a tag, based on get_tag_code from
+      Tags.pm.
   * lib/Tags.pm:
     + [RA] Support suppressing a list of tags.
   * lib/Util.pm:
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index 176aa9e..fc5e13e 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -43,6 +43,16 @@ our %INFO;
 # is called.
 our %MANUALS;
 
+# Map severity/certainty levels to tag codes.
+our %CODES = (
+    pedantic  => { 'wild-guess' => 'P', possible => 'P', certain => 'P' },
+    wishlist  => { 'wild-guess' => 'I', possible => 'I', certain => 'I' },
+    minor     => { 'wild-guess' => 'I', possible => 'I', certain => 'W' },
+    normal    => { 'wild-guess' => 'I', possible => 'W', certain => 'W' },
+    important => { 'wild-guess' => 'W', possible => 'E', certain => 'E' },
+    serious   => { 'wild-guess' => 'E', possible => 'E', certain => 'E' },
+);
+
 =head1 NAME
 
 Lintian::Tag::Info - Lintian interface to tag metadata
@@ -122,6 +132,21 @@ sub new {
 
 =over 4
 
+=item code()
+
+Returns the one-letter code for the tag.  This will be a letter chosen
+from C<E>, C<W>, C<I>, or C<P>, based on the tag severity, certainty, and
+other attributes (such as whether experimental is set).  This code will
+never be C<O> or C<X>; overrides and experimental tags are handled
+separately.
+
+=cut
+
+sub code {
+    my ($self) = @_;
+    return $CODES{$self->{severity}}{$self->{certainty}};
+}
+
 =item description([FORMAT [, INDENT]])
 
 Returns the formatted description (the Info field) for a tag.  FORMAT must

-- 
Debian package checker


Reply to: