[SCM] Debian package checker branch, master, updated. 2.5.4-154-gdde19e4
The following commit has been merged in the master branch:
commit cc53fe7a0be21a4fa384fbee902bdd7c907ea492
Author: Niels Thykier <niels@thykier.net>
Date: Wed Feb 8 09:48:46 2012 +0100
Add checks for certainty and severity in L::T::Info::new
This catches an incorrect .desc file for checks as soon as it is
loaded. It also makes a couple of other "certainty/severity" checks
redundant.
Signed-off-by: Niels Thykier <niels@thykier.net>
diff --git a/debian/changelog b/debian/changelog
index b7212f3..2635e34 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -809,6 +809,9 @@ lintian (2.5.3) unstable; urgency=low
+ [JW] Create links for references pointing to files in html
output.
+ [JW] Parse "#nnnnnn" references as links to Debian bugs.
+ + [NT] Check severity and certainty when loading checks. This
+ causes Lintian to reject checks with broken/incomplete tags
+ even if the tag was never used.
* lib/Lintian/Tag/Override.pm:
+ [NT] New file.
* lib/Lintian/Tags.pm:
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index 19c58fc..e69bea3 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -72,8 +72,7 @@ metadata elements or to format the tag description.
=item new(HASH, SCRIPT_NAME, SCRIPT_TYPE)
-Creates a new Lintian::Tag:Info - this constructor does not use the "cache"
-(as mentioned above) in anyway.
+Creates a new Lintian::Tag:Info.
=cut
@@ -81,15 +80,30 @@ sub new {
my ($class, $tag, $sn, $st) = @_;
my %copy;
my $self;
+ my $tagname;
croak 'no tag specified' unless $tag;
%copy = %$tag;
$self = \%copy;
croak "Missing Tag field" unless $self->{'tag'};
+ $tagname = $self->{'tag'};
+ croak "Missing Severity field for $tag" unless $self->{'severity'};
+ croak "Missing Certainity field for $tag" unless $self->{'certainty'};
$self->{'info'} = '' unless $self->{'info'};
$self->{'script'} = $sn;
$self->{'script-type'} = $st;
$self->{'effective-severity'} = $self->{severity};
- return bless $self, $class;
+
+ 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 $tag (severity:"
+ . " $self->{'severity'}, certainity: $self->{'certainty'}).\n";
+ }
+
+ return $self;
}
=back
@@ -244,14 +258,13 @@ sub description {
my $info = $self->{info};
$info =~ s/\n[ \t]/\n/g;
my @text = split_paragraphs($info);
+ my $severity = $self->severity;
+ my $certainty = $self->certainty;
+
if ($self->{ref}) {
push(@text, '', _format_reference($self->{ref}));
}
- if ($self->severity and $self->certainty) {
- my $severity = $self->severity;
- my $certainty = $self->certainty;
- push(@text, '', "Severity: $severity, Certainty: $certainty");
- }
+ push(@text, '', "Severity: $severity, Certainty: $certainty");
if ($self->{script} and $self->{'script-type'}){
my $script = $self->{script};
my $stype = $self->{'script-type'};
@@ -309,6 +322,7 @@ Modifies the effective severity of the tag.
sub set_severity{
my ($self, $sev) = @_;
+ croak "Unknown severity $sev.\n" unless exists $CODES{$sev};
$self->{'effective-severity'} = $sev;
}
diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index 9cf9d82..dd91d68 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -713,10 +713,8 @@ sub displayed {
my $display;
if ($severity eq 'pedantic') {
$display = $self->{show_pedantic} ? 1 : 0;
- } elsif ($severity and $certainty) {
- $display = $self->{display_level}{$severity}{$certainty};
} else {
- $display = 1;
+ $display = $self->{display_level}{$severity}{$certainty};
}
# If display_source is set, we need to check whether any of the references
--
Debian package checker
Reply to: