DOAP/Change.pm

filter: Statementstmt 89.2% 50 / 56 Branchbran 83.3% 5 / 6 Conditioncond 64.2% 9 / 14 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 90.9% 10 / 11 Podpod 0.0% 0 / 4 totaltotal 78.5% 77 / 98 CC 11 SCAR 13.1
CC
11
Cov
84%
BUILD
6.5
changelog_lines
5.2
changelog_links
2.0
CRAP 3.7
« DOAP/Project.pm ↑ Summary DOAP.pm »
1 package RDF::DOAP::Change;
2  
3 2 our $AUTHORITY = 'cpan:TOBYINK';
4 2 our $VERSION = '0.105';
5  
6 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 extends qw(RDF::DOAP::Resource);
8  
9 2 ▶use RDF::DOAP::Person;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use RDF::DOAP::Types -types;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use RDF::DOAP::Utils -traits;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use List::Util qw(uniq);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use Text::Wrap qw(wrap);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use RDF::Trine::Namespace qw(rdf rdfs owl xsd);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#');
17 2 my $dc = 'RDF::Trine::Namespace'->new('http://purl.org/dc/terms/');
18 2 my $dcs = 'RDF::Trine::Namespace'->new('http://ontologi.es/doap-changeset#');
19  
20 2 has blame => (
21 traits => [ WithURI, Gathering ],
22 is => 'ro',
23 isa => ArrayRef[Person],
24 coerce => 1,
25 uri => $dcs->blame,
26 multi => 1,
27 gather_as => ['contributor'],
28 );
29  
30 2 has thanks => (
31 traits => [ WithURI, Gathering ],
32 is => 'ro',
33 isa => ArrayRef[Person],
34 coerce => 1,
35 uri => $dcs->thanks,
36 multi => 1,
37 gather_as => ['thanks'],
38 );
39  
40 2 our %ROLES = (
41 $dcs->Addition => 'RDF::DOAP::Change::Addition',
42 $dcs->Removal => 'RDF::DOAP::Change::Removal',
43 $dcs->Bugfix => 'RDF::DOAP::Change::Bugfix',
44 $dcs->Update => 'RDF::DOAP::Change::Update',
45 $dcs->Regression => 'RDF::DOAP::Change::Regression',
46 $dcs->Documentation => 'RDF::DOAP::Change::Documentation',
47 $dcs->Packaging => 'RDF::DOAP::Change::Packaging',
48 $dcs->SecurityFix => 'RDF::DOAP::Change::SecurityFix',
49 $dcs->SecurityRegression => 'RDF::DOAP::Change::SecurityRegression',
50 );
51  
52 sub BUILD
53 9 ▶{
Subroutine BUILD: called CC=6 SCAR=18.7
Pod undocumented
54 9 my $self = shift;
55
56 9 ▶ my @roles = grep defined, map $ROLES{$_}, @{ $self->rdf_type || [] };
Condition50%1/2
$self->rdf_type || []
l!l
90
MC/DC0%0/1
$self->rdf_type || []
$self->rdf_type
Truth table50%1/2
A
A= $self->rdf_type
Aresult
11
00
57 9 ▶ push @roles, $ROLES{$dcs->Bugfix}
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_rdf_about and $self->has_rdf_model and $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef) 2 7 9
Condition50%3/6
$self->has_rdf_about and $self->has_rdf_model and $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
!ll&&!rl&&r
072
$self->has_rdf_about and $self->has_rdf_model
!ll&&!rl&&r
009
MC/DC33%1/3
$self->has_rdf_about and $self->has_rdf_model and $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
$self->has_rdf_about $self->has_rdf_model $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
Truth table50%2/4
A and B and C
A= $self->has_rdf_aboutB= $self->has_rdf_modelC= $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef)
ABCresult
0XX0
10X0
1100
1111
58 if $self->has_rdf_about
59 && $self->has_rdf_model
60 && $self->rdf_model->count_statements($self->rdf_about, $dcs->fixes, undef);
61
62 9 ▶ $self->Moose::Util::apply_all_roles(uniq @roles) if @roles;
Branch: 1 branch
BranchTrueFalseTotal
if @roles 8 1 9
63 }
64  
65 sub changelog_entry
66 0 ▶{
Subroutine changelog_entry: not called CC=1 SCAR=6.9
Pod undocumented
67 0 my $self = shift;
68 0 my $text = join "\n", $self->changelog_lines;
69 0 wrap(" - ", " ", $text);
70 }
71  
72 sub changelog_lines
73 8 ▶{
Subroutine changelog_lines: called CC=5 SCAR=16.5
Pod undocumented
74 8 my $self = shift;
75 8 my ($notype) = @_;
76
77 8 my @lines;
78 8 ▶ if ($notype)
Branch: 1 branch
BranchTrueFalseTotal
if ($notype) { } 8 0 8
79 {
80 8 @lines = $self->label;
81 }
82 else
83 {
84 0 my @type = sort map $_->uri =~ m{(\w+)$}, @{ $self->rdf_type };
85 0 @lines = "(@type) " . $self->label;
86 }
87
88 8 ▶ for my $person (uniq sort @{$self->blame||[]}, @{$self->thanks||[]})
Condition100%4/4
$self->blame || []
l!l
17
$self->thanks || []
l!l
17
MC/DC100%1/1
$self->blame || []
$self->blame
MC/DC100%1/1
$self->thanks || []
$self->thanks
Truth table100%2/2
A
A= $self->blame
Aresult
11
00
Truth table100%2/2
A
A= $self->thanks
Aresult
11
00
89 {
90 2 push @lines, sprintf("%s++", $person->to_string('compact'));
91 }
92
93 8 push @lines, $self->changelog_links;
94
95 8 return @lines;
96 }
97  
98 sub changelog_links
99 8 ▶{
Subroutine changelog_links: called CC=2 SCAR=7.1
Pod undocumented
100 8 my $self = shift;
101 8 ▶ return @{ $self->see_also || [] };
Condition50%1/2
$self->see_also || []
l!l
80
MC/DC0%0/1
$self->see_also || []
$self->see_also
Truth table50%1/2
A
A= $self->see_also
Aresult
11
00
102 }
103  
104 2 1;
« DOAP/Project.pm ↑ Summary DOAP.pm »