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

[SCM] Debian package checker branch, master, updated. 1.24.4-57-gcfdcbc8



The following commit has been merged in the master branch:
commit eec41c05ec020905b8a64a71276c55115a4b638d
Author: Jordà Polo <jorda@ettin.org>
Date:   Mon Jul 21 17:52:35 2008 +0200

    Get code based on Severity and Certainty
    
    Instead of using Type, the E/W/I code is now based on Severity and Certainty.

diff --git a/lib/Tags.pm b/lib/Tags.pm
index 631cad4..5640046 100644
--- a/lib/Tags.pm
+++ b/lib/Tags.pm
@@ -76,9 +76,6 @@ my %info;
 # Currently selected file (not package!)
 my $current;
 
-my %codes = ( 'error' => 'E' , 'warning' => 'W' , 'info' => 'I' );
-my %colors = ( 'error' => 'red' , 'warning' => 'yellow' , 'info' => 'cyan' );
-
 my %severity_level = (
     'serious' => 4,
     'important' => 3,
@@ -93,6 +90,16 @@ my %certainty_level = (
     'wild-guess' => 0
 );
 
+my @codes = (
+    [ 'I', 'I', 'I' ], # wishlist (wild-guess, possible, certain)
+    [ 'I', 'I', 'W' ], # minor
+    [ 'I', 'W', 'W' ], # normal
+    [ 'W', 'E', 'E' ], # important
+    [ 'E', 'E', 'E' ], # serious
+);
+
+my %colors = ( 'E' => 'red' , 'W' => 'yellow' , 'I' => 'cyan' );
+
 my %type_to_sev = (
     'error' => 'important',
     'warning' => 'normal',
@@ -265,11 +272,13 @@ sub colored_html {
 
 sub print_tag {
     my ( $pkg_info, $tag_info, $information ) = @_;
+    my $sev = $tag_info->{severity};
+    my $cer = $tag_info->{certainty};
 
     my $extra = '';
     $extra = " @$information" if @$information;
     $extra = '' if $extra eq ' ';
-    my $code = $codes{$tag_info->{type}};
+    my $code = $codes[$severity_level{$sev}][$certainty_level{$cer}];
     $code = 'X' if exists $tag_info->{experimental};
     $code = 'O' if $tag_info->{overridden}{override};
     my $type = '';
@@ -277,9 +286,9 @@ sub print_tag {
 
     my $output = "$code: $pkg_info->{pkg}$type: ";
     if ($color eq 'always' || ($color eq 'auto' && -t STDOUT)) {
-        $output .= colored($tag_info->{tag}, $colors{$tag_info->{type}});
+        $output .= colored($tag_info->{tag}, $colors{$code});
     } elsif ($color eq 'html') {
-        $output .= colored_html($tag_info->{tag}, $colors{$tag_info->{type}});
+        $output .= colored_html($tag_info->{tag}, $colors{$code});
     } else {
         $output .= $tag_info->{tag};
     }

-- 
Debian package checker


Reply to: