CPANTS-Kwalitee-Report

 view release on metacpan or  search on metacpan

lib/CPANTS/Kwalitee/Report/Indicator.pm  view on Meta::CPAN

package CPANTS::Kwalitee::Report::Indicator;

$CPANTS::Kwalitee::Report::Indicator::VERSION   = '0.11';
$CPANTS::Kwalitee::Report::Indicator::AUTHORITY = 'cpan:MANWAR';

=head1 NAME

CPANTS::Kwalitee::Report::Indicator - Interface to Kwalitee Indicator.

=head1 VERSION

Version 0.11

=cut

use 5.006;
use Data::Dumper;
use List::Util qw(any);

use Moo;
use namespace::autoclean;

use overload q{""} => 'as_string', fallback => 1;

has [qw(types error remedy)] => (is => 'ro');
has 'name'    => (is => 'ro', required => 1);
has 'verbose' => (is => 'lazy');

sub _build_verbose { 0 }

=head1 DESCRIPTION

It represents Kwalitee Indicator.

=head1 SYNOPSIS

    use strict; use warnings;
    use CPANTS::Kwalitee::Report;

    my $report     = CPANTS::Kwalitee::Report->new;
    my $generators = $report->generators;
    my $indicators = $generators->[0]->indicators;

    print sprintf("Name       : %s\n", $indicators->[0]->name);
    print sprintf("Description: %s\n", $indicators->[0]->description);

=head1 METHODS

=head2 name()

Returns indicator name.

=head2 description()

Returns indicator name with types.

=cut

sub description {
    my ($self) = @_;

    my $types = $self->types;
    if (scalar(@$types)) {
        return sprintf("%s (%s)", $self->name, join(", ", @$types));
    }
    else {
        return $self->name;
    }
}

=head2 category()

Returns the indicator's category i.e core, optional or experimental.

=cut

sub category {
    my ($self) = @_;

    if ($self->is_optional) {
        return 'optional';



( run in 0.558 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )