blib/lib/Dist/Zilla/Plugin/HelpWanted.pm

filter: Statementstmt 100% 34 / 34 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 93.7% 45 / 48 CC 5 SCAR 10.5
CC
5
Cov
95%
setup_installer
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
↑ Summary
1 package Dist::Zilla::Plugin::HelpWanted;
2 2 our $AUTHORITY = 'cpan:YANICK';
3 # ABSTRACT: insert 'Help Wanted' information in the distribution's META
4 2 $Dist::Zilla::Plugin::HelpWanted::VERSION = '0.3.3';
5  
6 2 ▶use 5.34.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use List::MoreUtils qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 ▶use experimental qw/ signatures /;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 with qw/
15 Dist::Zilla::Role::Plugin
16 Dist::Zilla::Role::InstallTool
17 /;
18  
19 2 my @positions = qw/
20 maintainer
21 co-maintainer
22 coder
23 translator
24 documentation
25 tester
26 documenter
27 developer
28 helper
29 /;
30  
31 2 my %legacy = (
32 'co-maintainer' => 'maintainer',
33 'coder' => 'developer',
34 'documentation' => 'documenter',
35 );
36  
37 2 has [ @positions ] => (
38 is => 'rw',
39 isa => 'Bool',
40 default => 0,
41 );
42  
43 2 has positions => (
44 is => 'ro',
45 isa => 'Str',
46 default => '',
47 );
48  
49 3 ▶sub setup_installer($self) {
Subroutine setup_installer: called CC=5 SCAR=16.2
Pod undocumented
50  
51 3 for my $p ( split ' ', $self->positions ) {
52 8 ▶ eval { $self->$p(1); 1; }
Branch: 1 branch
BranchTrueFalseTotal
eval { do { $self->$p(1); 1 } } or die "position '${p}' not recognized\n" 8 0 8
53 or die "position '$p' not recognized\n";
54 }
55  
56 my @open_positions =
57 uniq
58 10 ▶ map { exists($legacy{$_}) ? $legacy{$_} : $_ }
Branch: 1 branch
BranchTrueFalseTotal
exists $legacy{$_} ? : 5 5 10
59 3 grep { $self->$_ } @positions;
60  
61 $self->zilla->distmeta->{x_help_wanted} = \@open_positions
62 3 ▶ if @open_positions;
Branch: 1 branch
BranchTrueFalseTotal
if @open_positions 3 0 3
63 }
64  
65 2 __PACKAGE__->meta->make_immutable;
66 2 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
67 2 1;
68  
69 __END__
↑ Summary