lib/Code/TidyAll/Role/HasIgnore.pm

filter: Statementstmt 97.3% 36 / 37 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod n/a totaltotal 96.0% 48 / 50 CC 2 SCAR 1.6
CC
2
Cov
95%
_parse_zglob_list
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/Code/TidyAll/Role/GenericExecutable.pm ↑ Summary blib/lib/Code/TidyAll/CacheModel/Shared.pm »
1 package Code::TidyAll::Role::HasIgnore;
2  
3 58 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 58 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 58 ▶use Code::TidyAll::Util::Zglob qw(zglobs_to_regex);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 58 ▶use Specio::Library::Builtins;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 58 ▶use Specio::Library::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 58 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 58 our $VERSION = '0.85';
13  
14 has ignore => (
15 is => 'ro',
16 isa => t( 'ArrayRef', of => t('NonEmptyStr') ),
17 176 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
18 58 );
19  
20 58 has ignore_regex => (
21 is => 'lazy',
22 isa => t('RegexpRef'),
23 );
24  
25 58 has ignores => (
26 is => 'lazy',
27 isa => t( 'ArrayRef', of => t('NonEmptyStr') ),
28 );
29  
30 has select => (
31 is => 'ro',
32 isa => t( 'ArrayRef', of => t('NonEmptyStr') ),
33 105 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
34 58 );
35  
36 207 ▶sub _build_ignores {
Subroutine _build_ignores: called CC=1 SCAR=0.0
37 207 my ($self) = @_;
38 207 return $self->_parse_zglob_list( $self->ignore );
39 }
40  
41 322 ▶sub _parse_zglob_list {
Subroutine _parse_zglob_list: called CC=2 SCAR=7.2
42 322 my ( $self, $zglobs ) = @_;
43 322 ▶ if ( my ($bad_zglob) = ( grep {m{^/}} @{$zglobs} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my($bad_zglob) = grep({m[^/];} @{$zglobs;})) 0 322 322
44 0 die qq{zglob '$bad_zglob' should not begin with slash};
45 }
46 322 return $zglobs;
47 }
48  
49 159 ▶sub _build_ignore_regex {
Subroutine _build_ignore_regex: called CC=1 SCAR=0.0
50 159 my ($self) = @_;
51 159 return zglobs_to_regex( @{ $self->ignores } );
52 }
53  
54 58 1;
55  
56 # ABSTRACT: A role for any class that has a list of ignored paths specified in zglob syntax
57  
58 __END__
« blib/lib/Code/TidyAll/Role/GenericExecutable.pm ↑ Summary blib/lib/Code/TidyAll/CacheModel/Shared.pm »