Role/WriteCREDITS.pm

filter: Statementstmt 27.9% 12 / 43 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 40.0% 2 / 5 Podpod 0.0% 0 / 1 totaltotal 19.1% 14 / 73 CC 12 SCAR 38.2
CC
12
Cov
19%
Build_CREDITS
72.0
__ANON__
30.0
__ANON__
2.0
CRAP 45.6
« Role/WriteCOPYRIGHT.pm ↑ Summary Role/WriteDOAP.pm »
1 package Dist::Inkt::Role::WriteCREDITS;
2  
3 1 our $AUTHORITY = 'cpan:TOBYINK';
4 1 our $VERSION = '0.110';
5  
6 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 with 'Dist::Inkt::Role::RDFModel';
10  
11 0 ▶after PopulateMetadata => sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
12 0 my $self = shift;
13
14 0 my @maint = $self->doap_project->gather_all_maintainers;
15 0 ▶ push @{ $self->metadata->{author} ||= [] }, map "$_", @maint if @maint;
Branch: 1 branch
BranchTrueFalseTotal
if @maint 0 0 0
Condition0%0/2
$self->metadata->{"author"} ||= []
l!l
00
MC/DC0%0/1
$self->metadata->{"author"} ||= []
$self->metadata->{"author"}
Truth table0%0/2
A
A= $self->metadata->{"author"}
Aresult
11
00
16
17 0 my %already = map +($_ => 1), @maint;
18 0 my @contrib = grep !$already{$_}, $self->doap_project->gather_all_contributors;
19 0 ▶ push @{ $self->metadata->{x_contributors} ||= [] }, map "$_", @contrib if @contrib;
Branch: 1 branch
BranchTrueFalseTotal
if @contrib 0 0 0
Condition0%0/2
$self->metadata->{"x_contributors"} ||= []
l!l
00
MC/DC0%0/1
$self->metadata->{"x_contributors"} ||= []
$self->metadata->{"x_contributors"}
Truth table0%0/2
A
A= $self->metadata->{"x_contributors"}
Aresult
11
00
20 1 };
21  
22 0 ▶after BUILD => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 my $self = shift;
24 0 unshift @{ $self->targets }, 'CREDITS';
25 1 };
26  
27 sub Build_CREDITS
28 0 ▶{
Subroutine Build_CREDITS: not called CC=8 SCAR=42.8
Pod undocumented
29 0 my $self = shift;
30 0 my $file = $self->targetfile('CREDITS');
31 0 ▶ $file->exists and return $self->log('Skipping %s; it already exists', $file);
Branch: 1 branch
BranchTrueFalseTotal
$file->exists and return $self->log("Skipping %s; it already exists", $file) 0 0 0
32 0 $self->log('Writing %s', $file);
33 0 ▶ $self->rights_for_generated_files->{'CREDITS'} ||= [
Branch: 1 branch
BranchTrueFalseTotal
if $self->DOES("Dist::Inkt::Role::WriteCOPYRIGHT") 0 0 0
Condition0%0/2
$self->rights_for_generated_files->{"CREDITS"} ||= ["None", "public-domain"]
l!l
00
MC/DC0%0/1
$self->rights_for_generated_files->{"CREDITS"} ||= ["None", "public-domain"]
$self->rights_for_generated_files->{"CREDITS"}
Truth table0%0/2
A
A= $self->rights_for_generated_files->{"CREDITS"}
Aresult
11
00
34 'None', 'public-domain'
35 ] if $self->DOES('Dist::Inkt::Role::WriteCOPYRIGHT');
36
37 0 my $fh = $file->openw_utf8;
38
39 0 my %already;
40 0 for my $role (qw/ maintainer contributor thanks /)
41 {
42 0 (my $method = "gather_all_${role}s") =~ s/ss$/s/s;
43 my @peeps =
44 0 sort { $a->to_string cmp $b->to_string }
45 0 ▶ grep { blessed($_) and not $already{$_}++ }
Condition0%0/3
builtin::blessed($_) && !$already{$_}++
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($_) && !$already{$_}++
builtin::blessed($_) !$already{$_}++
Truth table0%0/3
A && not(B)
A= builtin::blessed($_)B= !$already{$_}++
ABresult
0X0
100
111
46 $self->doap_project->$method;
47 0 ▶ next unless @peeps;
Branch: 1 branch
BranchTrueFalseTotal
unless @peeps 0 0 0
48
49 0 printf {$fh} ("%s:\n", ucfirst $role);
50 0 printf {$fh} ("- %s\n", $_->to_string) for @peeps;
51 0 printf {$fh} ("\n");
52 }
53
54 0 close($fh);
55 }
56  
57 1 1;
« Role/WriteCOPYRIGHT.pm ↑ Summary Role/WriteDOAP.pm »