GitGot/Outputter.pm

filter: Statementstmt 93.5% 29 / 31 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.9% 10 / 11 Podpod 100% 4 / 4 totaltotal 84.9% 45 / 53 CC 3 SCAR 5.3
CC
3
Cov
86%
_colored
3.7
warning
2.0
BEGIN
1.0
CRAP 1.7
« GitGot/Repositories.pm ↑ Summary GitGot/Command/update_status.pm »
1 package App::GitGot::Outputter;
2 8 our $AUTHORITY = 'cpan:GENEHACK';
3 8 $App::GitGot::Outputter::VERSION = '1.339';
4 # ABSTRACT: Generic base class for outputting formatted messages.
5 8 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 8 ▶use Term::ANSIColor qw/ colored /;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 8 ▶use Types::Standard -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 8 ▶use App::GitGot::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 8 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15  
16 8 has no_color => (
17 is => 'ro' ,
18 isa => Bool ,
19 default => 0 ,
20 documentation => 'boolean indicating whether color messages should be output at all' ,
21 );
22  
23  
24 3 ▶sub error {
Subroutine error: called CC=1 SCAR=0.0
Pod documented
25 3 my( $self , $message ) = @_;
26 3 return $self->_colored( $message , $self->color_error );
27 }
28  
29  
30 8 ▶sub major_change {
Subroutine major_change: called CC=1 SCAR=0.0
Pod documented
31 8 my( $self , $message ) = @_;
32 8 return $self->_colored( $message , $self->color_major_change );
33 }
34  
35  
36 9 ▶sub minor_change {
Subroutine minor_change: called CC=1 SCAR=0.0
Pod documented
37 9 my( $self , $message ) = @_;
38 9 return $self->_colored( $message , $self->color_minor_change );
39 }
40  
41  
42 0 ▶sub warning {
Subroutine warning: not called CC=1 SCAR=6.9
Pod documented
43 0 my( $self , $message ) = @_;
44 0 return $self->_colored( $message , $self->color_warning );
45 }
46  
47 20 ▶sub _colored {
Subroutine _colored: called CC=3 SCAR=13.1
48 20 my( $self , $message , $color_string ) = @_;
49  
50 20 ▶ return ( $self->no_color || $color_string eq 'uncolored' ) ? $message
Branch: 1 branch
BranchTrueFalseTotal
$self->no_color || $color_string eq 'uncolored' ? : 20 0 20
Condition33%1/3
$self->no_color or $color_string eq "uncolored"
l!l&&r!l&&!r
2000
MC/DC0%0/2
$self->no_color or $color_string eq "uncolored"
$self->no_color $color_string eq "uncolored"
Truth table33%1/3
A or B
A= $self->no_colorB= $color_string eq "uncolored"
ABresult
1X1
011
000
51 : colored( $message , $color_string );
52 }
53  
54 8 1;
55  
56 __END__
« GitGot/Repositories.pm ↑ Summary GitGot/Command/update_status.pm »