blib/lib/TAP/Harness/Restricted.pm

filter: Statementstmt 100% 40 / 40 Branchbran 87.5% 7 / 8 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 95.0% 57 / 60 CC 6 SCAR 9.9
CC
6
Cov
96%
_file_ok
5.0
aggregate_tests
2.0
BEGIN
1.0
CRAP 2.7
↑ Summary
1 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
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 package TAP::Harness::Restricted;
6 # ABSTRACT: Skip some test files
7  
8 1 our $VERSION = '0.004';
9  
10 1 ▶use superclass 'TAP::Harness' => 3.18;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶sub aggregate_tests {
Subroutine aggregate_tests: called CC=2 SCAR=6.9
Pod documented
14 1 my ( $self, $aggregate, @tests ) = @_;
15 1 ▶ my %banned_files = map { $_ => undef } map { glob } split " ",
Subroutine BEGIN: called CC=1 SCAR=0.0
Condition50%1/2
$ENV{'HARNESS_SKIP'} || ''
l!l
10
MC/DC0%0/1
$ENV{'HARNESS_SKIP'} || ''
$ENV{'HARNESS_SKIP'}
Truth table50%1/2
A
A= $ENV{'HARNESS_SKIP'}
Aresult
11
00
16 1 $ENV{HARNESS_SKIP} || '';
17 1 @tests = grep { _file_ok( $_, \%banned_files ) } @tests;
18 1 return $self->SUPER::aggregate_tests( $aggregate, @tests );
19 }
20  
21 1 my $maybe_prefix = qr/(?:\d+[_-]?)?/;
22  
23 1 my @banned_names = (
24 qr/${maybe_prefix}pod\.t/,
25 qr/${maybe_prefix}pod[_-]?coverage\.t/,
26 qr/${maybe_prefix}pod[_-]?spell(?:ing)?\.t/,
27 qr/${maybe_prefix}perl[_-]?critic\.t/,
28 qr/${maybe_prefix}kwalitee\.t/,
29 );
30  
31 1 my @banned_code = (
32 qr/\b (?: use | require )\ Test::(?:
33 CleanNamespaces | DependentModules | EOL | Kwalitee | Mojibake
34 | NoTabs | Perl::Critic | Pod | Portability::Files | Spelling | Vars
35 )\b/x,
36 );
37  
38 28 ▶sub _file_ok {
Subroutine _file_ok: called CC=5 SCAR=16.1
39 28 my $file = path(shift);
40 28 my $banned_files = shift;
41 28 ▶ return unless $file->exists;
Branch: 1 branch
BranchTrueFalseTotal
unless $file->exists 0 28 28
42 28 my $basename = $file->basename;
43 28 ▶ return if grep { $basename =~ $_ } @banned_names;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$basename =~ /$_/;} @banned_names 14 14 28
44 14 ▶ return if exists $banned_files->{ $file->relative };
Branch: 1 branch
BranchTrueFalseTotal
if exists $$banned_files{$file->relative} 3 11 14
45 11 my $guts = $file->slurp;
46 11 ▶ return if grep { $guts =~ m{$_}ms } @banned_code;
Branch: 1 branch
BranchTrueFalseTotal
if grep {$guts =~ /$_/ms;} @banned_code 9 2 11
47 2 return 1;
48 }
49  
50 1 1;
51  
52  
53 # vim: ts=4 sts=4 sw=4 et:
54  
55 __END__
↑ Summary