| 1 | package Dist::Zilla::PluginBundle::TestingMania; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: test your dist with every testing plugin conceivable | ||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | our $VERSION = '0.25'; # VERSION | |||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use List::MoreUtils qw( any ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | with 'Dist::Zilla::Role::PluginBundle::Easy'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | has enable => ( | ||||||||||||||||||||||||||||||||||||||||||
| 14 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 15 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||||||||||||||||
| 16 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | ▶ | default => sub { $_[0]->payload->{enable} || [] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | has disable => ( | ||||||||||||||||||||||||||||||||||||||||||
| 21 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||
| 22 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||||||||||||||||||||||||
| 23 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | ▶ | default => sub { $_[0]->payload->{disable} || [] }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | ); | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | 4 | ▶ | sub mvp_multivalue_args { qw(enable disable) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mvp_multivalue_args: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 4 | ▶ | sub configure { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
configure: called CC=12 SCAR=25.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 4 | my %plugins = ( | |||||||||||||||||||||||||||||||||||||||||
| 33 | 'Test::CPAN::Changes' => $self->config_slice('changelog'), | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 'Test::CPAN::Meta::JSON'=> 1, # prunes itself if META.json isn't there | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 'Test::Pod::LinkCheck' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 36 | 'Test::Version' => $self->config_slice('has_version', { strict_version => 'is_strict' }), | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 'Test::Compile' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | 'Test::Perl::Critic' => $self->config_slice('critic_config'), | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 'Test::DistManifest' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 40 | 'Test::EOL' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 'Test::Kwalitee' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 42 | MetaTests => 1, # should only be loaded if MetaYAML is loaded, or the file exists in the dist | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 'Test::MinimumVersion' => $self->config_slice('max_target_perl'), | ||||||||||||||||||||||||||||||||||||||||||
| 44 | MojibakeTests => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 'Test::NoTabs' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | PodCoverageTests => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | PodSyntaxTests => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 'Test::Portability' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 'Test::Synopsis' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 'Test::UnusedVars' => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 4 | my %synonyms = ( | |||||||||||||||||||||||||||||||||||||||||
| 53 | 'NoTabsTests' => 'Test::NoTabs', | ||||||||||||||||||||||||||||||||||||||||||
| 54 | 'EOLTests' => 'Test::EOL', | ||||||||||||||||||||||||||||||||||||||||||
| 55 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 4 | my @include = (); | |||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | my @disable = | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | map { $synonyms{$_} ? $synonyms{$_} : $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | map { (split /,\s?/, $_) } | |||||||||||||||||||||||||||||||||||||||||
| 61 | 4 | @{ $self->disable }; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 4 | foreach my $plugin (keys %plugins) { | |||||||||||||||||||||||||||||||||||||||||
| 63 | next if ( # Skip... | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 71 | ▶ | any { $_ eq $plugin } @disable or # plugins they asked to skip | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 562 | ▶ | any { $_ eq $plugin } @include or # plugins we already included | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 72 | ▶ | !$plugins{$plugin} # plugins in the list, but which we don't want to add | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
&any(sub {
$_ eq $plugin;
}
, @disable) or &any(sub {
$_ eq $plugin;
}
, @include) or not $plugins{$plugin}
&any(sub {
$_ eq $plugin;
}
, @disable) or &any(sub {
$_ eq $plugin;
}
, @include)
MC/DC33%1/3
&any(sub {
$_ eq $plugin;
}
, @disable) or &any(sub {
$_ eq $plugin;
}
, @include) or not $plugins{$plugin}
&any(sub {
$_ eq $plugin;
}
, @disable)
&any(sub {
$_ eq $plugin;
}
, @include)
not $plugins{$plugin}
Truth table50%2/4
A or B or not(C)
A= &any(sub {
$_ eq $plugin;
}
, @disable)B= &any(sub {
$_ eq $plugin;
}
, @include)C= not $plugins{$plugin}
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 68 | push(@include, ref $plugins{$plugin} | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 69 | ▶ | ? [ $plugin => $plugins{$plugin} ] | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | : $plugin); | ||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | my @enable = | ||||||||||||||||||||||||||||||||||||||||||
| 74 | 1 | ▶ | map { $synonyms{$_} ? $synonyms{$_} : $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 75 | 1 | map { (split /,\s?/, $_) } | |||||||||||||||||||||||||||||||||||||||||
| 76 | 4 | @{ $self->enable }; | |||||||||||||||||||||||||||||||||||||||||
| 77 | 4 | foreach my $plugin (@enable) { | |||||||||||||||||||||||||||||||||||||||||
| 78 | 1 | ▶ | next unless any { $_ eq $plugin } %plugins; # Skip the plugin unless it is in the list of actual testing plugins | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | push(@include, $plugin) unless ( any { $_ eq $plugin } @include or any { $_ eq $plugin } @disable); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=1.2
Subroutine
__ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
Condition33%1/3
&any(sub {
$_ eq $plugin;
}
, @include) or &any(sub {
$_ eq $plugin;
}
, @disable)
MC/DC0%0/2
&any(sub {
$_ eq $plugin;
}
, @include) or &any(sub {
$_ eq $plugin;
}
, @disable)
&any(sub {
$_ eq $plugin;
}
, @include)
&any(sub {
$_ eq $plugin;
}
, @disable)
Truth table33%1/3
A or B
A= &any(sub {
$_ eq $plugin;
}
, @include)B= &any(sub {
$_ eq $plugin;
}
, @disable)
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 4 | $self->add_plugins(@include); | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | 2 | __PACKAGE__->meta->make_immutable(); | |||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | 2 | ▶ | no Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 2 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | __END__ | ||||||||||||||||||||||||||||||||||||||||||