Badge-Depot-Plugin-Coverage

 view release on metacpan or  search on metacpan

lib/Badge/Depot/Plugin/Coverage.pm  view on Meta::CPAN

         : $coverage < 90 ? 'orange'
         : $coverage < 100 ? 'yellow'
         : $coverage == 100 ? 'brightgreen'
         :                     'blue'
         ;
}
sub log {
    my $self = shift;
    my $text = shift;

    say "[Badge/Coverage] $text";

};

__PACKAGE__->meta->make_immutable;

1;

__END__

=pod

=encoding UTF-8

=head1 NAME

Badge::Depot::Plugin::Coverage - Code coverage plugin for Badge::Depot

=head1 VERSION

Version 0.0102, released 2020-12-26.

=head1 SYNOPSIS

Used standalone:

    use Badge::Depot::Plugin::Coverage;

    my $badge = Badge::Depot::Plugin::Coverage->new(coverage => 87);

    print $badge->to_html;

Used together with L<Pod::Weaver::Section::Badges>, in weaver.ini:

    [Badges]
    ; other settings
    badge = Coverage

=head1 DESCRIPTION

This L<Badge::Depot> badge is meant to be used together with L<Dist::Zilla::App::Command::coverh> (or standalone, as per the synopsis) and creates a coverage badge:

=for HTML <p><img src="https://img.shields.io/badge/coverage-87%25-orange.svg" /></p>

=for markdown ![Coverage 87%](https://img.shields.io/badge/coverage-87%25-orange.svg)

=head1 ATTRIBUTES

=head2 coverage

Set the code coverage percentage manually. Should only be used when L<Dist::Zilla::App::Command::coverh> is B<not> used.

=head2 custom_image_url

Default: C<https://img.shields.io/badge/%s-%s-%s.svg>

Override the default image url. It is expected to have three C<sprintf> placeholders: Text, coverage percentage and color.

=head2 max_age

Default: C<60>

When used together with L<Dist::Zilla::App::Command::coverh>, only include the badge if the latest coverage run was less than C<max_age> minutes ago.

=head2 text

Default: C<coverage>

Set a different coverage percentage. The percentage sign will be appended.

=head1 SEE ALSO

=over 4

=item *

L<Badge::Depot>

=item *

L<Task::Badge::Depot>

=back

=head1 SOURCE

L<https://github.com/Csson/p5-Badge-Depot-Plugin-Coverage>

=head1 HOMEPAGE

L<https://metacpan.org/release/Badge-Depot-Plugin-Coverage>

=head1 AUTHOR

Erik Carlsson <info@code301.com>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by Erik Carlsson.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut



( run in 1.045 second using v1.01-cache-2.11-cpan-39bf76dae61 )