blib/lib/Dist/Zilla/App/Command/cover.pm

filter: Statementstmt 41.9% 13 / 31 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 100% 2 / 2 totaltotal 46.3% 19 / 41 CC 2 SCAR 9.4
CC
2
Cov
39%
execute
6.0
abstract
2.0
BEGIN
1.0
CRAP 2.6
↑ Summary
1 package Dist::Zilla::App::Command::cover;
2 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 # ABSTRACT: Code coverage metrics for your distribution
6 1 our $VERSION = '1.101001'; # VERSION
7  
8 1 ▶use Dist::Zilla::App -command;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 0 ▶sub abstract { "code coverage metrics for your distribution" }
Subroutine abstract: not called CC=1 SCAR=6.9
Pod documented
12  
13 0 ▶sub execute {
Subroutine execute: not called CC=2 SCAR=17.9
Pod documented
14 0 my $self = shift;
15 0 require File::Temp;
16 0 require Path::Class;
17 0 require File::chdir;
18  
19 0 local $ENV{HARNESS_PERL_SWITCHES} = '-MDevel::Cover';
20 0 my @cover_command = @ARGV;
21  
22 # adapted from the 'test' command
23 0 my $zilla = $self->zilla;
24 0 my $build_root = Path::Class::dir('.build');
25 0 ▶ $build_root->mkpath unless -d $build_root;
Branch: 1 branch
BranchTrueFalseTotal
unless -d $build_root 0 0 0
26 0 my $target = Path::Class::dir(File::Temp::tempdir(DIR => $build_root));
27 0 $self->log("building test distribution under $target");
28  
29 # Don't run author and release tests during code coverage.
30 # local $ENV{AUTHOR_TESTING} = 1;
31 # local $ENV{RELEASE_TESTING} = 1;
32  
33 0 $zilla->ensure_built_in($target);
34 0 $self->zilla->run_tests_in($target);
35  
36 0 $self->log(join ' ' => @cover_command);
37 0 local $File::chdir::CWD = $target;
38 0 system @cover_command;
39 0 $self->log("leaving $target intact");
40 }
41  
42 1 1;
43  
44 __END__
↑ Summary