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

Bug#969769: ability to filter on severity when listing all tags



Hi Jelmer,

On Fri, Sep 11, 2020 at 4:47 AM Jelmer Vernooij <jelmer@debian.org> wrote:
>
> something like "explain-lintian-tags -l
> --severity=warning,pedantic".

Despite some reflection I'm not keen on expanding what I think is a
flawed interface. At the same time, I do not wish to stand in the
Janitor's way. Could you perhaps use the JSON interface of that
command, and filter yourself? Here is some code that should do more or
less what you require:

    use IPC::Run3;
    use JSON::MaybeXS;

    my $list_out;
    my @command = qw{/usr/bin/lintian-explain-tags --format json};
    run3(\@command, undef, \$list_out);

    my $definitions = decode_json($list_out);
    my @sorted = sort { lc($a->{Name}) cmp lc($b->{Name}) } @{$definitions};

    my @errors = grep { $_{visibility} eq 'error' } @sorted;
    my @warnings = grep { $_{visibility} eq 'warning' } @sorted;

In the future, you will also be able to use your code on this URL:

    https://lintian.debian.org/query/tags (returns JSON)

Kind regards
Felix Lechner


Reply to: