[lintian] 05/12: Add support for "classification" tags
This is an automated email from the git hooks/post-receive script.
nthykier pushed a commit to branch master
in repository lintian.
commit 43cf4b39d60c73fd4da097d66768cb9569ae4f1c
Author: Niels Thykier <niels@thykier.net>
Date: Sun Mar 6 18:01:22 2016 +0000
Add support for "classification" tags
Signed-off-by: Niels Thykier <niels@thykier.net>
---
doc/lintian.xml | 9 ++++++---
lib/Lintian/Internal/FrontendUtil.pm | 2 +-
lib/Lintian/Output.pm | 3 ++-
lib/Lintian/Output/LetterQualifier.pm | 5 +++++
lib/Lintian/Profile.pm | 13 +++++++++++--
lib/Lintian/Tag/Info.pm | 7 +++++++
lib/Lintian/Tags.pm | 5 ++++-
reporting/templates/lintian.css.tmpl | 10 ++++++++++
8 files changed, 46 insertions(+), 8 deletions(-)
diff --git a/doc/lintian.xml b/doc/lintian.xml
index bfd0464..43601a9 100644
--- a/doc/lintian.xml
+++ b/doc/lintian.xml
@@ -929,9 +929,12 @@ foo [!any-i386] binary: some-tag-not-for-i386 optional-extra
<term><emphasis>Severity</emphasis> (simple, optional)</term>
<listitem>
<para>
- The value must be a valid tag severity; the severity
- of the affected tags is set to this value. Note
- that <emphasis>experimental</emphasis> is not a
+ The value must be a valid tag severity other than "classification".
+ The severity of the affected tags is set to this value. This
+ cannot be used on any tag that is defined as a "classification" tag.
+ </para>
+ <para>
+ Note that <emphasis>experimental</emphasis> is not a
severity.
</para>
</listitem>
diff --git a/lib/Lintian/Internal/FrontendUtil.pm b/lib/Lintian/Internal/FrontendUtil.pm
index 05f2947..ae391a4 100644
--- a/lib/Lintian/Internal/FrontendUtil.pm
+++ b/lib/Lintian/Internal/FrontendUtil.pm
@@ -160,7 +160,7 @@ sub default_parallel {
# Where the marked part(s) are optional values. The numbers above
# the example are the capture groups.
my $TAG_REGEX
- = qr/([EWIXOP]): (\S+)(?: (\S+)(?:$verarchre)?)?: (\S+)(?:\s+(.*))?/o;
+ = qr/([EWIXOPC]): (\S+)(?: (\S+)(?:$verarchre)?)?: (\S+)(?:\s+(.*))?/o;
sub split_tag {
my ($tag_input) = @_;
diff --git a/lib/Lintian/Output.pm b/lib/Lintian/Output.pm
index d026bd7..2884d37 100644
--- a/lib/Lintian/Output.pm
+++ b/lib/Lintian/Output.pm
@@ -144,7 +144,8 @@ my %default_colors = (
'E' => 'red',
'W' => 'yellow',
'I' => 'cyan',
- 'P' => 'green'
+ 'P' => 'green',
+ 'C' => 'blue',
);
our $GLOBAL = Lintian::Output->new;
diff --git a/lib/Lintian/Output/LetterQualifier.pm b/lib/Lintian/Output/LetterQualifier.pm
index 8c26620..a1926f1 100644
--- a/lib/Lintian/Output/LetterQualifier.pm
+++ b/lib/Lintian/Output/LetterQualifier.pm
@@ -28,6 +28,11 @@ use Lintian::Output qw(:util);
use parent qw(Lintian::Output);
my %codes = (
+ 'classification' => {
+ 'wild-guess' => 'C?',
+ 'possible' => 'C ',
+ 'certain' => 'C!'
+ },
'pedantic' => {
'wild-guess' => 'P?',
'possible' => 'P ',
diff --git a/lib/Lintian/Profile.pm b/lib/Lintian/Profile.pm
index 9a6d057..4c901a5 100644
--- a/lib/Lintian/Profile.pm
+++ b/lib/Lintian/Profile.pm
@@ -417,13 +417,22 @@ sub _read_profile_section {
qq{Profile "$pname" contains invalid severity},
qq{"$severity" in section $sno}))
- if $severity && !$SEVERITIES{$severity};
+ if $severity
+ && (!$SEVERITIES{$severity} || $severity eq 'classification');
foreach my $tag (@tags) {
croak "Unknown check $tag in $pname (section $sno)"
unless $self->{'known-tags'}{$tag};
if ($severity) {
- $self->{'known-tags'}{$tag}->set_severity($severity);
+ my $t = $self->{'known-tags'}{$tag};
+ if ($t->severity(1) eq 'classification') {
+ croak(
+ join(q{ },
+ qq{${tag} is a classification tag},
+ q{and cannot not be assigned a severity},
+ qq{(profile "$pname", section $sno)}));
+ }
+ $t->set_severity($severity);
}
if ($overridable != -1) {
if ($overridable) {
diff --git a/lib/Lintian/Tag/Info.pm b/lib/Lintian/Tag/Info.pm
index 40437de..2de6e4f 100644
--- a/lib/Lintian/Tag/Info.pm
+++ b/lib/Lintian/Tag/Info.pm
@@ -43,6 +43,7 @@ our $MANUALS
# Map severity/certainty levels to tag codes.
our %CODES = (
+ classification => { 'wild-guess' => 'C', possible => 'C', certain => 'C' },
pedantic => { 'wild-guess' => 'P', possible => 'P', certain => 'P' },
wishlist => { 'wild-guess' => 'I', possible => 'I', certain => 'I' },
minor => { 'wild-guess' => 'I', possible => 'I', certain => 'W' },
@@ -278,6 +279,12 @@ sub description {
. ' ignore experimental tags that do not seem to make sense,'
. ' though of course bug reports are always welcome.');
}
+ if ($severity eq 'classification') {
+ push(@text,
+ '',
+ 'This tag intended as a classification'
+ . ' and is <i>not</i> an issue in the package.');
+ }
# Format and return the output.
if ($format eq 'text') {
diff --git a/lib/Lintian/Tags.pm b/lib/Lintian/Tags.pm
index b417556..bc24c5d 100644
--- a/lib/Lintian/Tags.pm
+++ b/lib/Lintian/Tags.pm
@@ -42,7 +42,8 @@ BEGIN {
our $GLOBAL;
# Ordered lists of severities and certainties, used for display level parsing.
-our @SEVERITIES = qw(pedantic wishlist minor normal important serious);
+our @SEVERITIES
+ = qw(classification pedantic wishlist minor normal important serious);
our @CERTAINTIES = qw(wild-guess possible certain);
=head1 NAME
@@ -146,6 +147,8 @@ sub new {
my $self = {
current => undef,
display_level => {
+ classification =>
+ { 'wild-guess' => 0, possible => 0, certain => 0 },
wishlist => { 'wild-guess' => 0, possible => 0, certain => 0 },
minor => { 'wild-guess' => 0, possible => 0, certain => 1 },
normal => { 'wild-guess' => 0, possible => 1, certain => 1 },
diff --git a/reporting/templates/lintian.css.tmpl b/reporting/templates/lintian.css.tmpl
index 8cd6af9..f6de64c 100644
--- a/reporting/templates/lintian.css.tmpl
+++ b/reporting/templates/lintian.css.tmpl
@@ -369,6 +369,11 @@ span.type-P {
background-color: #C7EA3C;
}
+span.type-C {
+ color: #111;
+ background-color: blue;
+}
+
li.type-O {
color: #444;
}
@@ -404,6 +409,11 @@ blockquote.type-P {
border: 1px solid #C7EA3C;
}
+blockquote.type-C {
+ background-color: #DFA;
+ border: 1px solid #C7EA3C;
+}
+
/*
* 5. Footer
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: