IsDev/NegativeHeuristic/HomeDir.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 86.2% 44 / 51 CC 5 SCAR 8.2
CC
5
Cov
87%
paths
4.2
excludes
2.3
BEGIN
1.0
CRAP 2.3
« IsDev/Role/Matcher/Child/Exists/Any/Dir.pm ↑ Summary IsDev/Role/HeuristicSet.pm »
1 12 ▶use 5.008; # utf8
Subroutine BEGIN: called CC=1 SCAR=0.0
2 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 12 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Path::IsDev::NegativeHeuristic::HomeDir;
7  
8 12 our $VERSION = '1.001003';
9  
10 # ABSTRACT: User home directories are not development roots
11  
12 12 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
13  
14 ## no critic (RequireArgUnpacking, ProhibitSubroutinePrototypes)
15 16 ▶sub _uniq (@) {
Subroutine _uniq: called CC=1 SCAR=0.0
16 16 my %seen = ();
17 16 return grep { not $seen{$_}++ } @_;
18 }
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35 12 ▶use Role::Tiny::With qw( with );
Subroutine BEGIN: called CC=1 SCAR=0.0
36 12 with 'Path::IsDev::Role::NegativeHeuristic', 'Path::IsDev::Role::Matcher::FullPath::Is::Any';
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53 16 ▶sub paths {
Subroutine paths: called CC=4 SCAR=14.3
Pod documented
54 16 my @sources;
55 16 require File::HomeDir;
56 16 push @sources, File::HomeDir->my_home;
57 16 for my $method (qw( my_home my_desktop my_music my_pictures my_videos my_data )) {
58 96 ▶ if ( $File::HomeDir::IMPLEMENTED_BY->can($method) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($File::HomeDir::IMPLEMENTED_BY->can($method)) 96 0 96
59 96 push @sources, File::HomeDir->$method();
60 }
61 }
62 16 ▶ return _uniq grep { defined and length } @sources;
Condition33%1/3
defined $_ && length $_
!ll&&!rl&&r
00112
MC/DC0%0/2
defined $_ && length $_
defined $_ length $_
Truth table33%1/3
A && B
A= defined $_B= length $_
ABresult
0X0
100
111
63 }
64  
65  
66  
67  
68  
69  
70  
71 16 ▶sub excludes {
Subroutine excludes: called CC=2 SCAR=8.1
Pod documented
72 16 my ( $self, $result_object ) = @_;
73 16 ▶ return unless $self->fullpath_is_any( $result_object, $self->paths );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->fullpath_is_any($result_object, $self->paths) 16 0 16
74 0 return 1;
75 }
76 12 1;
77  
78 __END__
« IsDev/Role/Matcher/Child/Exists/Any/Dir.pm ↑ Summary IsDev/Role/HeuristicSet.pm »