| 1 | package App::CriticDB; | ||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 1 | ▶ | use Carp qw/confess/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | ▶ | use App::CriticDB::Collector; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 1 | ▶ | use App::CriticDB::DB; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 1 | ▶ | use App::CriticDB::Report; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | our $VERSION='0.0.6'; | |||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 1 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||
| 14 | 1 | my ($ref,%opt)=@_; | |||||||||||||||||||
| 15 | 1 | ▶ | my $class=ref($ref)||$ref; | ||||||||||||||||||
|
Condition33%1/3
ref $ref || $ref
MC/DC0%0/2
ref $ref || $ref
ref $ref
$ref
Truth table33%1/3
A || B
A= ref $refB= $ref
| |||||||||||||||||||||
| 16 | 1 | my %self; | |||||||||||||||||||
| 17 | 1 | ▶ | if($opt{file}) { %self=(mode=>'file',file=>$opt{file},type=>$opt{type}//'storable') } | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$opt{"type"} // "storable"
MC/DC0%0/1
$opt{"type"} // "storable"
$opt{"type"}
Truth table50%1/2
A
A= $opt{"type"}
| |||||||||||||||||||||
| 18 | 0 | else { confess('Only file mode is available at this time') } | |||||||||||||||||||
| 19 | 1 | @self{qw/profile debug/}=@opt{qw/profile debug/}; | |||||||||||||||||||
| 20 | 1 | return bless(\%self,$class); | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 0 | ▶ | sub _load { | ||||||||||||||||||
|
Subroutine
_load: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 24 | 0 | my ($self)=@_; | |||||||||||||||||||
| 25 | 0 | ▶ | if($$self{db}) { return } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 26 | 0 | $$self{db}=App::CriticDB::DB->new(%$self); | |||||||||||||||||||
| 27 | 0 | return $self; | |||||||||||||||||||
| 28 | } | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | ▶ | sub collect { | ||||||||||||||||||
|
Subroutine
collect: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 31 | 0 | my ($self,@paths)=@_; | |||||||||||||||||||
| 32 | 0 | $self->_load(); | |||||||||||||||||||
| 33 | 0 | $$self{db}->cleanup(); | |||||||||||||||||||
| 34 | $$self{collector}//=App::CriticDB::Collector->new( | ||||||||||||||||||||
| 35 | profile=>$$self{profile}, | ||||||||||||||||||||
| 36 | debug=>$$self{debug}, | ||||||||||||||||||||
| 37 | 0 | ▶ | store=>sub{$$self{db}->store(@_)}, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 38 | 0 | ▶ | flush=>sub{$$self{db}->flush(@_)}, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 39 | 0 | ▶ | newer=>sub{$$self{db}->newer(@_)}, | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 40 | 0 | ▶ | ); | ||||||||||||||||||
|
Condition0%0/3
$self->{"collector"} //= "App::CriticDB::Collector"->new("profile", $self->{"profile"}, "debug", $self->{"debug"}, "store", sub {
$self->{"db"}->store(@_);
}
, "flush", sub {
$self->{"db"}->flush(@_);
}
, "newer", sub {
$self->{"db"}->newer(@_);
}
)
MC/DC0%0/2
$self->{"collector"} //= "App::CriticDB::Collector"->new("profile", $self->{"profile"}, "debug", $self->{"debug"}, "store", sub {
$self->{"db"}->store(@_);
}
, "flush", sub {
$self->{"db"}->flush(@_);
}
, "newer", sub {
$self->{"db"}->newer(@_);
}
)
$self->{"collector"}
"App::CriticDB::Collector"->new("profile", $self->{"profile"}, "debug", $self->{"debug"}, "store", sub {
$self->{"db"}->store(@_);
}
, "flush", sub {
$self->{"db"}->flush(@_);
}
, "newer", sub {
$self->{"db"}->newer(@_);
}
)
Truth table0%0/3
A //= B
A= $self->{"collector"}B= "App::CriticDB::Collector"->new("profile", $self->{"profile"}, "debug", $self->{"debug"}, "store", sub {
$self->{"db"}->store(@_);
}
, "flush", sub {
$self->{"db"}->flush(@_);
}
, "newer", sub {
$self->{"db"}->newer(@_);
}
)
| |||||||||||||||||||||
| 41 | 0 | $$self{collector}->collect(@paths); | |||||||||||||||||||
| 42 | 0 | return $self; | |||||||||||||||||||
| 43 | } | ||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 0 | ▶ | sub report { | ||||||||||||||||||
|
Subroutine
report: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||
| 46 | 0 | my ($self,%opt)=@_; | |||||||||||||||||||
| 47 | 0 | $self->_load(); | |||||||||||||||||||
| 48 | 0 | my $report=App::CriticDB::Report->new(verbose=>$opt{verbose}); | |||||||||||||||||||
| 49 | 0 | ▶ | while(my $violation=$$self{db}->report()) { print $report->text($violation) } | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 50 | 0 | return $self; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 1 | 1; | |||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||