blib/lib/Test/EOL.pm

filter: Statementstmt 38.2% 86 / 225 Branchbran 24.5% 27 / 110 Conditioncond 31.0% 36 / 116 MC/DCmcdc 18.6% 11 / 59 Subroutinesub 45.7% 16 / 35 Podpod 100% 4 / 4 totaltotal 32.7% 180 / 549 CC 101 SCAR 37.7
CC
101
Cov
33%
eol_unix_ok
116.1
eol_unix_ok
116.1
_is_perl_script
42.0
CRAP 43.3
↑ Summary
1 package Test::EOL; # git description: v2.01-2-g00e2666
2 # ABSTRACT: Check the correct line endings in your project
3  
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 our $VERSION = '2.02';
8  
9 3 ▶use Test::Builder;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use File::Find;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 3 ▶use Cwd qw/ cwd /;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶our $PERL = $^X || 'perl';
Condition50%1/2
$^X || 'perl'
l!l
30
MC/DC0%0/1
$^X || 'perl'
$^X
Truth table50%1/2
A
A= $^X
Aresult
11
00
15 3 our $UNTAINT_PATTERN = qr|^([-+@\w./:\\]+)$|;
16 3 our $PERL_PATTERN = qr/^#!.*perl/;
17  
18 3 ▶my %file_find_arg = ($] <= 5.006) ? () : (
Branch: 1 branch
BranchTrueFalseTotal
$] <= 5.006 ? : 0 3 3
19 untaint => 1,
20 untaint_pattern => $UNTAINT_PATTERN,
21 untaint_skip => 1,
22 );
23  
24 3 my $Test = Test::Builder->new;
25  
26 3 my $no_plan;
27  
28 3 ▶sub import {
Subroutine import: called CC=3 SCAR=15.9
29 0 ▶ my $self = shift;
Subroutine import: not called CC=3 SCAR=15.9
30 0 my $caller = caller;
31 {
32 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.1
33 0 *{$caller.'::eol_unix_ok'} = \&eol_unix_ok;
34 0 *{$caller.'::all_perl_files_ok'} = \&all_perl_files_ok;
35 }
36 0 $Test->exported_to($caller);
37  
38 0 ▶ if ($_[0] && $_[0] eq 'no_plan') {
Branch: 2 branches
BranchTrueFalseTotal
if ($_[0] and $_[0] eq "no_plan") 0 3 3
if ($_[0] and $_[0] eq "no_plan") 0 0 0
Condition16%1/6
$_[0] and $_[0] eq "no_plan"
!ll&&!rl&&r
300
$_[0] and $_[0] eq "no_plan"
!ll&&!rl&&r
000
MC/DC0%0/2
$_[0] and $_[0] eq "no_plan"
$_[0] $_[0] eq "no_plan"
MC/DC0%0/2
$_[0] and $_[0] eq "no_plan"
$_[0] $_[0] eq "no_plan"
Truth table33%1/3
A and B
A= $_[0]B= $_[0] eq "no_plan"
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $_[0]B= $_[0] eq "no_plan"
ABresult
0X0
100
111
39 0 shift;
40 0 $no_plan = 1;
41 }
42 0 $Test->plan(@_);
43 }
44  
45 2 ▶sub _all_perl_files {
Subroutine _all_perl_files: called CC=3 SCAR=18.5
46 0 ▶ my @all_files = _all_files(@_);
Subroutine _all_perl_files: not called CC=3 SCAR=18.5
47 0 ▶ return grep { _is_perl_module($_) || _is_perl_script($_) || _is_pod_file($_) } @all_files;
Condition16%2/12
_is_perl_module($_) || _is_perl_script($_) || _is_pod_file($_)
l!l&&r!l&&!r
200
_is_perl_module($_) or _is_perl_script($_)
l!l&&r!l&&!r
200
_is_perl_module($_) || _is_perl_script($_) || _is_pod_file($_)
l!l&&r!l&&!r
000
_is_perl_module($_) or _is_perl_script($_)
l!l&&r!l&&!r
000
MC/DC0%0/3
_is_perl_module($_) || _is_perl_script($_) || _is_pod_file($_)
_is_perl_module($_) _is_perl_script($_) _is_pod_file($_)
MC/DC0%0/3
_is_perl_module($_) || _is_perl_script($_) || _is_pod_file($_)
_is_perl_module($_) _is_perl_script($_) _is_pod_file($_)
Truth table25%1/4
A or B || C
A= _is_perl_module($_)B= _is_perl_script($_)C= _is_pod_file($_)
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/4
A or B || C
A= _is_perl_module($_)B= _is_perl_script($_)C= _is_pod_file($_)
ABCresult
1XX1
01X1
0011
0000
48 }
49  
50 3 ▶sub _all_files {
Subroutine _all_files: called CC=3 SCAR=14.5
51 0 ▶ my @base_dirs = @_ ? @_ : cwd();
Subroutine _all_files: not called CC=3 SCAR=14.5
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 3 0 3
@_ ? : 0 0 0
52 0 ▶ my $options = pop(@base_dirs) if ref $base_dirs[-1] eq 'HASH';
Branch: 2 branches
BranchTrueFalseTotal
if ref $base_dirs[-1] eq "HASH" 1 2 3
if ref $base_dirs[-1] eq "HASH" 0 0 0
53 0 my @found;
54 27 ▶ my $want_sub = sub {
Subroutine __ANON__: called CC=12 SCAR=34.5
55 0 ▶ my @chunks = ('', File::Spec->splitdir($File::Find::name));
Subroutine __ANON__: not called CC=12 SCAR=34.5
56  
57 0 ▶ return $File::Find::prune = 1 if -d $File::Find::name and
Branch: 2 branches
BranchTrueFalseTotal
if -d $File::Find::name and $chunks[-1] eq "CVS" || $chunks[-1] eq ".svn" || $chunks[-2] eq "blib" && $chunks[-1] eq "libdoc" || $chunks[-2] eq "blib" && $chunks[-1] =~ /^man[0-9]$/ || $chunks[-1] eq "inc" 5 22 27
if -d $File::Find::name and $chunks[-1] eq "CVS" || $chunks[-1] eq ".svn" || $chunks[-2] eq "blib" && $chunks[-1] eq "libdoc" || $chunks[-2] eq "blib" && $chunks[-1] =~ /^man[0-9]$/ || $chunks[-1] eq "inc" 0 0 0
Condition50%21/42
-d $File::Find::name and $chunks[-1] eq "CVS" || $chunks[-1] eq ".svn" || $chunks[-2] eq "blib" && $chunks[-1] eq "libdoc" || $chunks[-2] eq "blib" && $chunks[-1] =~ /^man[0-9]$/ || $chunks[-1] eq "inc"
!ll&&!rl&&r
10125
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn" or $chunks[-2] eq "blib" and $chunks[-1] eq "libdoc" or $chunks[-2] eq "blib" and $chunks[-1] =~ /^man[0-9]$/ or $chunks[-1] eq "inc"
l!l&&r!l&&!r
4112
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn" or $chunks[-2] eq "blib" and $chunks[-1] eq "libdoc" or $chunks[-2] eq "blib" and $chunks[-1] =~ /^man[0-9]$/
l!l&&r!l&&!r
3113
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn" or $chunks[-2] eq "blib" and $chunks[-1] eq "libdoc"
l!l&&r!l&&!r
2114
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn"
l!l&&r!l&&!r
1115
$chunks[-2] eq "blib" and $chunks[-1] eq "libdoc"
!ll&&!rl&&r
1221
$chunks[-2] eq "blib" and $chunks[-1] =~ /^man[0-9]$/
!ll&&!rl&&r
1211
-d $File::Find::name and $chunks[-1] eq "CVS" || $chunks[-1] eq ".svn" || $chunks[-2] eq "blib" && $chunks[-1] eq "libdoc" || $chunks[-2] eq "blib" && $chunks[-1] =~ /^man[0-9]$/ || $chunks[-1] eq "inc"
!ll&&!rl&&r
000
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn" or $chunks[-2] eq "blib" and $chunks[-1] eq "libdoc" or $chunks[-2] eq "blib" and $chunks[-1] =~ /^man[0-9]$/ or $chunks[-1] eq "inc"
l!l&&r!l&&!r
000
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn" or $chunks[-2] eq "blib" and $chunks[-1] eq "libdoc" or $chunks[-2] eq "blib" and $chunks[-1] =~ /^man[0-9]$/
l!l&&r!l&&!r
000
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn" or $chunks[-2] eq "blib" and $chunks[-1] eq "libdoc"
l!l&&r!l&&!r
000
$chunks[-1] eq "CVS" or $chunks[-1] eq ".svn"
l!l&&r!l&&!r
000
$chunks[-2] eq "blib" and $chunks[-1] eq "libdoc"
!ll&&!rl&&r
000
$chunks[-2] eq "blib" and $chunks[-1] =~ /^man[0-9]$/
!ll&&!rl&&r
000
MC/DC100%8/8
-d $File::Find::name and $chunks[-1] eq "CVS" || $chunks[-1] eq ".svn" || $chunks[-2] eq "blib" && $chunks[-1] eq "libdoc" || $chunks[-2] eq "blib" && $chunks[-1] =~ /^man[0-9]$/ || $chunks[-1] eq "inc"
-d $File::Find::name $chunks[-1] eq "CVS" $chunks[-1] eq ".svn" $chunks[-2] eq "blib" $chunks[-1] eq "libdoc" $chunks[-2] eq "blib" $chunks[-1] =~ /^man[0-9]$/ $chunks[-1] eq "inc"
MC/DC0%0/8
-d $File::Find::name and $chunks[-1] eq "CVS" || $chunks[-1] eq ".svn" || $chunks[-2] eq "blib" && $chunks[-1] eq "libdoc" || $chunks[-2] eq "blib" && $chunks[-1] =~ /^man[0-9]$/ || $chunks[-1] eq "inc"
-d $File::Find::name $chunks[-1] eq "CVS" $chunks[-1] eq ".svn" $chunks[-2] eq "blib" $chunks[-1] eq "libdoc" $chunks[-2] eq "blib" $chunks[-1] =~ /^man[0-9]$/ $chunks[-1] eq "inc"
Truth table57%8/14
A and B or C or D and E or F and G or H
A= -d $File::Find::nameB= $chunks[-1] eq "CVS"C= $chunks[-1] eq ".svn"D= $chunks[-2] eq "blib"E= $chunks[-1] eq "libdoc"F= $chunks[-2] eq "blib"G= $chunks[-1] =~ /^man[0-9]$/H= $chunks[-1] eq "inc"
ABCDEFGHresult
0XXXXXXX0
1000X0X00
1000X1000
100100X00
100101000
11XXXXXX1
101XXXXX1
10011XXX1
1000X11X1
1001011X1
1000X0X11
1000X1011
100100X11
100101011
Truth table0%0/14
A and B or C or D and E or F and G or H
A= -d $File::Find::nameB= $chunks[-1] eq "CVS"C= $chunks[-1] eq ".svn"D= $chunks[-2] eq "blib"E= $chunks[-1] eq "libdoc"F= $chunks[-2] eq "blib"G= $chunks[-1] =~ /^man[0-9]$/H= $chunks[-1] eq "inc"
ABCDEFGHresult
0XXXXXXX0
1000X0X00
1000X1000
100100X00
100101000
11XXXXXX1
101XXXXX1
10011XXX1
1000X11X1
1001011X1
1000X0X11
1000X1011
100100X11
100101011
58 ( $chunks[-1] eq 'CVS' # cvs
59 or $chunks[-1] eq '.svn' # subversion
60 or ($chunks[-2] eq 'blib' and $chunks[-1] eq 'libdoc') # pod doc
61 or ($chunks[-2] eq 'blib' and $chunks[-1] =~ /^man[0-9]$/) # pod doc
62 or $chunks[-1] eq 'inc'); # Module::Install
63  
64 0 ▶ return if $chunks[-1] eq 'Build'; # autogenerated Build script
Branch: 2 branches
BranchTrueFalseTotal
if $chunks[-1] eq "Build" 1 21 22
if $chunks[-1] eq "Build" 0 0 0
65 0 ▶ return unless (-f $File::Find::name && -r _);
Branch: 2 branches
BranchTrueFalseTotal
unless -f $File::Find::name and -r _ 12 9 21
unless -f $File::Find::name and -r _ 0 0 0
Condition33%2/6
-f $File::Find::name and -r _
!ll&&!rl&&r
1209
-f $File::Find::name and -r _
!ll&&!rl&&r
000
MC/DC50%1/2
-f $File::Find::name and -r _
-f $File::Find::name -r _
MC/DC0%0/2
-f $File::Find::name and -r _
-f $File::Find::name -r _
Truth table66%2/3
A and B
A= -f $File::Find::nameB= -r _
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= -f $File::Find::nameB= -r _
ABresult
0X0
100
111
66  
67 0 shift @chunks;
68 0 push @found, File::Spec->catfile(@chunks);
69 0 };
70 0 my $find_arg = {
71 %file_find_arg,
72 wanted => $want_sub,
73 no_chdir => 1,
74 };
75 0 find( $find_arg, @base_dirs);
76 0 return File::Spec->no_upwards(@found);
77 }
78  
79 # Formats various human invisible symbols
80 # to similar visible ones.
81 # Perhaps ^M or something like that
82 # would be more appropriate?
83  
84 0 ▶sub _show_whitespace {
Subroutine _show_whitespace: not called CC=1 SCAR=6.9
85 0 ▶ my $string = shift;
Subroutine _show_whitespace: not called CC=1 SCAR=6.9
86 0 $string =~ s/\r/[\\r]/g;
87 0 $string =~ s/\t/[\\t]/g;
88 0 $string =~ s/ /[\\s]/g;
89 0 return $string;
90 }
91  
92 # Format a line record for diagnostics.
93  
94 0 ▶sub _debug_line {
Subroutine _debug_line: not called CC=2 SCAR=17.9
95 0 ▶ my ( $options, $line ) = @_;
Subroutine _debug_line: not called CC=2 SCAR=17.9
96 0 $line->[2] =~ s/\n\z//g;
97 return "line $line->[1]: $line->[0]" . (
98 0 ▶ $options->{show_lines} ? qq{: } . _show_whitespace( $line->[2] ) : q{}
Branch: 2 branches
BranchTrueFalseTotal
$options->{'show_lines'} ? : 0 0 0
$options->{'show_lines'} ? : 0 0 0
99 );
100 }
101  
102 7 ▶sub eol_unix_ok {
Subroutine eol_unix_ok: called CC=17 SCAR=47.5
Pod documented
103 0 ▶ my $file = shift;
Subroutine eol_unix_ok: not called CC=17 SCAR=47.5
Pod documented
104 0 my $test_txt;
105 0 ▶ $test_txt = shift if !ref $_[0];
Branch: 2 branches
BranchTrueFalseTotal
unless ref $_[0] 6 1 7
unless ref $_[0] 0 0 0
106 0 ▶ $test_txt ||= "No incorrect line endings in '$file'";
Condition50%2/4
$test_txt ||= "No incorrect line endings in '${file}'"
l!l
16
$test_txt ||= "No incorrect line endings in '${file}'"
l!l
00
MC/DC100%1/1
$test_txt ||= "No incorrect line endings in '${file}'"
$test_txt
MC/DC0%0/1
$test_txt ||= "No incorrect line endings in '${file}'"
$test_txt
Truth table100%2/2
A
A= $test_txt
Aresult
11
00
Truth table0%0/2
A
A= $test_txt
Aresult
11
00
107 0 ▶ my $options = shift if ref $_[0] eq 'HASH';
Branch: 2 branches
BranchTrueFalseTotal
if ref $_[0] eq "HASH" 1 6 7
if ref $_[0] eq "HASH" 0 0 0
108 0 ▶ $options ||= {
Condition50%2/4
$options ||= {"trailing_whitespace", 0, "all_reasons", 0}
l!l
52
$options ||= {"trailing_whitespace", 0, "all_reasons", 0}
l!l
00
MC/DC100%1/1
$options ||= {"trailing_whitespace", 0, "all_reasons", 0}
$options
MC/DC0%0/1
$options ||= {"trailing_whitespace", 0, "all_reasons", 0}
$options
Truth table100%2/2
A
A= $options
Aresult
11
00
Truth table0%0/2
A
A= $options
Aresult
11
00
109 trailing_whitespace => 0,
110 all_reasons => 0,
111 };
112 0 $file = _module_to_path($file);
113  
114 0 ▶ open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open $file: $!"); return; };
Branch: 2 branches
BranchTrueFalseTotal
open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open ${file}: $!"); return } 7 0 7
open my $fh, $file or do { $Test->ok(0, $test_txt); $Test->diag("Could not open ${file}: $!"); return } 0 0 0
115 # Windows-- , default is :crlf, which hides \r\n -_-
116 0 binmode( $fh, ':raw' );
117 0 my $line = 0;
118 0 my @fails;
119 0 ▶ while (<$fh>) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined($_ = readline $fh)) 963 7 970
if (defined($_ = readline $fh)) 0 0 0
120 0 $line++;
121 0 ▶ if ( !$options->{trailing_whitespace} && /(\r+)$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $options->{"trailing_whitespace"} and /(\r+)$/) 0 963 963
if (not $options->{"trailing_whitespace"} and /(\r+)$/) 0 0 0
Condition33%2/6
not $options->{"trailing_whitespace"} and /(\r+)$/
!ll&&!rl&&r
139500
not $options->{"trailing_whitespace"} and /(\r+)$/
!ll&&!rl&&r
000
MC/DC0%0/2
not $options->{"trailing_whitespace"} and /(\r+)$/
not $options->{"trailing_whitespace"} /(\r+)$/
MC/DC0%0/2
not $options->{"trailing_whitespace"} and /(\r+)$/
not $options->{"trailing_whitespace"} /(\r+)$/
Truth table66%2/3
not(A) and B
A= not $options->{"trailing_whitespace"}B= /(\r+)$/
ABresult
0X0
100
111
Truth table0%0/3
not(A) and B
A= not $options->{"trailing_whitespace"}B= /(\r+)$/
ABresult
0X0
100
111
122 0 my $match = $1;
123 0 push @fails, [ _show_whitespace( $match ) , $line , $_ ];
124 }
125 0 ▶ if ( $options->{trailing_whitespace} && /([ \t]*\r+|[ \t]+)$/ ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($options->{"trailing_whitespace"} and /([ \t]*\r+|[ \t]+)$/) 0 963 963
if ($options->{"trailing_whitespace"} and /([ \t]*\r+|[ \t]+)$/) 0 0 0
Condition33%2/6
$options->{"trailing_whitespace"} and /([ \t]*\r+|[ \t]+)$/
!ll&&!rl&&r
950130
$options->{"trailing_whitespace"} and /([ \t]*\r+|[ \t]+)$/
!ll&&!rl&&r
000
MC/DC0%0/2
$options->{"trailing_whitespace"} and /([ \t]*\r+|[ \t]+)$/
$options->{"trailing_whitespace"} /([ \t]*\r+|[ \t]+)$/
MC/DC0%0/2
$options->{"trailing_whitespace"} and /([ \t]*\r+|[ \t]+)$/
$options->{"trailing_whitespace"} /([ \t]*\r+|[ \t]+)$/
Truth table66%2/3
A and B
A= $options->{"trailing_whitespace"}B= /([ \t]*\r+|[ \t]+)$/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= $options->{"trailing_whitespace"}B= /([ \t]*\r+|[ \t]+)$/
ABresult
0X0
100
111
126 0 my $match = $1;
127 0 push @fails, [ _show_whitespace($match), $line , $_ ];
128 }
129 # Minor short-circuit for people who don't need the whole file scanned
130 # once there's an err.
131 0 ▶ last if( @fails > 0 && !$options->{all_reasons} );
Branch: 2 branches
BranchTrueFalseTotal
if @fails > 0 and not $options->{"all_reasons"} 0 963 963
if @fails > 0 and not $options->{"all_reasons"} 0 0 0
Condition16%1/6
@fails > 0 and not $options->{"all_reasons"}
!ll&&!rl&&r
96300
@fails > 0 and not $options->{"all_reasons"}
!ll&&!rl&&r
000
MC/DC0%0/2
@fails > 0 and not $options->{"all_reasons"}
@fails > 0 not $options->{"all_reasons"}
MC/DC0%0/2
@fails > 0 and not $options->{"all_reasons"}
@fails > 0 not $options->{"all_reasons"}
Truth table33%1/3
A and not(B)
A= @fails > 0B= not $options->{"all_reasons"}
ABresult
0X0
100
111
Truth table0%0/3
A and not(B)
A= @fails > 0B= not $options->{"all_reasons"}
ABresult
0X0
100
111
132 }
133 0 ▶ if( @fails ){
Branch: 2 branches
BranchTrueFalseTotal
if (@fails) 0 7 7
if (@fails) 0 0 0
134 0 $Test->ok( 0, $test_txt . " on " . _debug_line({ show_lines => 0 } , $fails[0] ) );
135 0 ▶ if ( $options->{all_reasons} || 1 ){
Branch: 2 branches
BranchTrueFalseTotal
if ($options->{"all_reasons"} or 1) 0 0 0
if ($options->{"all_reasons"} or 1) 0 0 0
Condition0%0/4
$options->{"all_reasons"} or 1
l!l
00
$options->{"all_reasons"} or 1
l!l
00
MC/DC0%0/1
$options->{"all_reasons"} or 1
$options->{"all_reasons"}
MC/DC0%0/1
$options->{"all_reasons"} or 1
$options->{"all_reasons"}
Truth table0%0/2
A
A= $options->{"all_reasons"}
Aresult
11
00
Truth table0%0/2
A
A= $options->{"all_reasons"}
Aresult
11
00
136 0 $Test->diag( " Problem Lines: ");
137 0 for ( @fails ){
138 0 $Test->diag(_debug_line({ show_lines => 1 } , $_ ) );
139 }
140 }
141 0 return 0;
142 }
143 0 $Test->ok(1, $test_txt);
144 0 return 1;
145 }
146 2 ▶sub all_perl_files_ok {
Subroutine all_perl_files_ok: called CC=3 SCAR=15.4
Pod documented
147 0 ▶ my $options = shift if ref $_[0] eq 'HASH';
Subroutine all_perl_files_ok: not called CC=3 SCAR=15.4
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
if ref $_[0] eq "HASH" 0 2 2
if ref $_[0] eq "HASH" 0 0 0
148 0 my @files = _all_perl_files( @_ );
149 0 _make_plan();
150 0 foreach my $file ( @files ) {
151 0 eol_unix_ok($file, $options);
152 }
153 }
154  
155 2 ▶sub _is_perl_module {
Subroutine _is_perl_module: called CC=2 SCAR=11.6
156 0 ▶ $_[0] =~ /\.pm$/i || $_[0] =~ /::/;
Subroutine _is_perl_module: not called CC=2 SCAR=11.6
Branch: 2 branches
BranchTrueFalseTotal
$_[0] =~ /\.pm$/i or $_[0] =~ /::/ 2 0 2
$_[0] =~ /\.pm$/i or $_[0] =~ /::/ 0 0 0
157 }
158  
159 0 ▶sub _is_pod_file {
Subroutine _is_pod_file: not called CC=1 SCAR=6.9
160 0 ▶ $_[0] =~ /\.pod$/i;
Subroutine _is_pod_file: not called CC=1 SCAR=6.9
161 }
162  
163 0 ▶sub _is_perl_script {
Subroutine _is_perl_script: not called CC=6 SCAR=37.4
164 0 ▶ my $file = shift;
Subroutine _is_perl_script: not called CC=6 SCAR=37.4
165 0 ▶ return 1 if $file =~ /\.pl$/i;
Branch: 2 branches
BranchTrueFalseTotal
if $file =~ /\.pl$/i 0 0 0
if $file =~ /\.pl$/i 0 0 0
166 0 ▶ return 1 if $file =~ /\.t$/;
Branch: 2 branches
BranchTrueFalseTotal
if $file =~ /\.t$/ 0 0 0
if $file =~ /\.t$/ 0 0 0
167 0 ▶ open (my $fh, $file) or return;
Branch: 2 branches
BranchTrueFalseTotal
open my $fh, $file or return 0 0 0
open my $fh, $file or return 0 0 0
168 0 my $first = <$fh>;
169 0 ▶ return 1 if defined $first && ($first =~ $PERL_PATTERN);
Branch: 2 branches
BranchTrueFalseTotal
if defined $first and $first =~ /$Test::EOL::PERL_PATTERN/ 0 0 0
if defined $first and $first =~ /$Test::EOL::PERL_PATTERN/ 0 0 0
Condition0%0/6
defined $first and $first =~ /$Test::EOL::PERL_PATTERN/
!ll&&!rl&&r
000
defined $first and $first =~ /$Test::EOL::PERL_PATTERN/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $first and $first =~ /$Test::EOL::PERL_PATTERN/
defined $first $first =~ /$Test::EOL::PERL_PATTERN/
MC/DC0%0/2
defined $first and $first =~ /$Test::EOL::PERL_PATTERN/
defined $first $first =~ /$Test::EOL::PERL_PATTERN/
Truth table0%0/3
A and B
A= defined $firstB= $first =~ /$Test::EOL::PERL_PATTERN/
ABresult
0X0
100
111
Truth table0%0/3
A and B
A= defined $firstB= $first =~ /$Test::EOL::PERL_PATTERN/
ABresult
0X0
100
111
170 0 return;
171 }
172  
173 7 ▶sub _module_to_path {
Subroutine _module_to_path: called CC=6 SCAR=35.3
174 0 ▶ my $file = shift;
Subroutine _module_to_path: not called CC=6 SCAR=35.3
175 0 ▶ return $file unless ($file =~ /::/);
Branch: 2 branches
BranchTrueFalseTotal
unless $file =~ /::/ 7 0 7
unless $file =~ /::/ 0 0 0
176 0 my @parts = split /::/, $file;
177 0 my $module = File::Spec->catfile(@parts) . '.pm';
178 0 foreach my $dir (@INC) {
179 0 my $candidate = File::Spec->catfile($dir, $module);
180 0 ▶ next unless (-e $candidate && -f _ && -r _);
Branch: 2 branches
BranchTrueFalseTotal
unless -e $candidate and -f _ and -r _ 0 0 0
unless -e $candidate and -f _ and -r _ 0 0 0
Condition0%0/12
-e $candidate and -f _ and -r _
!ll&&!rl&&r
000
-e $candidate and -f _
!ll&&!rl&&r
000
-e $candidate and -f _ and -r _
!ll&&!rl&&r
000
-e $candidate and -f _
!ll&&!rl&&r
000
MC/DC0%0/3
-e $candidate and -f _ and -r _
-e $candidate -f _ -r _
MC/DC0%0/3
-e $candidate and -f _ and -r _
-e $candidate -f _ -r _
Truth table0%0/4
A and B and C
A= -e $candidateB= -f _C= -r _
ABCresult
0XX0
10X0
1100
1111
Truth table0%0/4
A and B and C
A= -e $candidateB= -f _C= -r _
ABCresult
0XX0
10X0
1100
1111
181 0 return $candidate;
182 }
183 0 return $file;
184 }
185  
186 2 ▶sub _make_plan {
Subroutine _make_plan: called CC=3 SCAR=16.5
187 0 ▶ return if $no_plan;
Subroutine _make_plan: not called CC=3 SCAR=16.5
Branch: 2 branches
BranchTrueFalseTotal
if $no_plan 0 2 2
if $no_plan 0 0 0
188 0 ▶ unless ($Test->has_plan) {
Branch: 2 branches
BranchTrueFalseTotal
unless ($Test->has_plan) 2 0 2
unless ($Test->has_plan) 0 0 0
189 0 $Test->plan( 'no_plan' );
190 }
191 0 $Test->expected_tests;
192 }
193  
194 0 ▶sub _untaint {
Subroutine _untaint: not called CC=2 SCAR=17.9
195 0 ▶ my @untainted = map { ($_ =~ $UNTAINT_PATTERN) } @_;
Subroutine _untaint: not called CC=2 SCAR=17.9
196 0 ▶ return wantarray ? @untainted : $untainted[0];
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 0 0 0
wantarray ? : 0 0 0
197 }
198  
199 3 1;
200  
201 __END__
↑ Summary