table of contents
Lintian::Tags(3) | Debian Package Checker | Lintian::Tags(3) |
NAME¶
Lintian::Tags - Manipulate and output Lintian tags
SYNOPSIS¶
my $tags = Lintian::Tags->new; my $proc = Lintian::Processable->new; $proc->init_from_file('/path/to/file'); $tags->file_start ($proc); $tags->file_overrides ('/path/to/an/overrides-file'); $tags->tag ('lintian-tag', 'extra tag information'); tag ('other-lintian-tag', 'with some extra data'); tag ('third-lintian-tag'); # with no extra). my %overrides = $tags->overrides ($proc); my %stats = $tags->statistics; if ($tags->displayed ('lintian-tag')) { # do something if that tag would be displayed... }
DESCRIPTION¶
This module stores metadata about Lintian tags, stores configuration about which tags should be displayed, handles displaying tags if appropriate, and stores cumulative statistics about what tags have been seen. It also accepts override information and determines whether a tag has been overridden, keeping override statistics. Finally, it supports answering metadata questions about Lintian tags, such as what references Lintian has for that tag.
Each Lintian::Tags object has its own tag list, file list, and associated statistics. Separate Lintian::Tags objects can be maintained and used independently. However, as a convenience for Lintian's most typical use case and for backward compatibility, the first created Lintian::Tags object is maintained as a global default. The tag() method can be called as a global function instead of a method, in which case it will act on that global default Lintian::Tags object.
CLASS METHODS¶
- new()
- Creates a new Lintian::Tags object, initializes all of its internal statistics and configuration to the defaults, and returns the newly created object.
- tag(TAG, [EXTRA, ...])
- Issue the Lintian tag TAG, possibly suppressing it or not displaying it
based on configuration. EXTRA, if present, is additional information to
display with the tag. It can be given as a list of strings, in which case
they're joined by a single space before display.
This method can be called either as a class method (which is exported by the Lintian::Tags module) or as an instance method. If called as a class method, it uses the first-constructed Lintian::Tags object as its underlying object.
This method throws an exception if it is called without file_start() being called first or if an attempt is made to issue an unknown tag.
INSTANCE METHODS¶
Configuration¶
- display(OPERATION, RELATION, SEVERITY, CERTAINTY)
- Configure which tags are displayed by severity and certainty. OPERATION is
"+" to display the indicated tags,
"-" to not display the indicated tags,
or "=" to not display any tags except
the indicated ones. RELATION is one of
"<",
"<=",
"=",
">=", or
">". The OPERATION will be applied to
all pairs of severity and certainty that match the given RELATION on the
SEVERITY and CERTAINTY arguments. If either of those arguments are
undefined, the action applies to any value for that variable. For example:
$tags->display('=', '>=', 'important');
turns off display of all tags and then enables display of any tag (with any certainty) of severity important or higher.
$tags->display('+', '>', 'normal', 'possible');
adds to the current configuration display of all tags with a severity higher than normal and a certainty higher than possible (so important/certain and serious/certain).
$tags->display('-', '=', 'minor', 'possible');
turns off display of tags of severity minor and certainty possible.
This method throws an exception on errors, such as an unknown severity or certainty or an impossible constraint (like "> serious").
- show_experimental(BOOL)
- If BOOL is true, configure experimental tags to be shown. If BOOL is false, configure experimental tags to not be shown.
- show_overrides(BOOL)
- If BOOL is true, configure overridden tags to be shown. If BOOL is false, configure overridden tags to not be shown.
- sources([SOURCE [, ...]])
- Limits the displayed tags to only those from the listed sources. One or more sources may be given. If no sources are given, resets the Lintian::Tags object to display tags from any source. Tag sources are the names of references from the Ref metadata for the tags.
- profile(PROFILE)
- Use the PROFILE (Lintian::Profile) to determine which tags are suppressed, the severity of the tags and which tags are non-overridable.
Tag Reporting¶
- displayed(TAG)
- Returns true if the given tag would be displayed given the current configuration, false otherwise. This does not check overrides, only whether the tag severity, certainty, and source warrants display given the configuration.
- suppressed(TAG)
- Returns true if the given tag would be suppressed given the current configuration, false otherwise. This is different than displayed() in that a tag is only suppressed if Lintian treats the tag as if it's never been seen, doesn't update statistics, and doesn't change its exit status. Tags are suppressed via profile().
AUTHOR¶
Originally written by Russ Allbery <rra@debian.org> for Lintian.
SEE ALSO¶
lintian(1), Lintian::Tag::Info(3)
2020-02-23 | Lintian v2.55.0 |