| 1 | package RDF::DOAP::Change::Bugfix; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | our $AUTHORITY = 'cpan:TOBYINK'; | |||||||||||||
| 4 | 1 | our $VERSION = '0.105'; | |||||||||||||
| 5 | |||||||||||||||
| 6 | 1 | ▶ | use Moose::Role; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | 1 | requires qw( rdf_about rdf_model ); | |||||||||||||
| 8 | |||||||||||||||
| 9 | 1 | ▶ | use RDF::DOAP::Issue; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 10 | 1 | ▶ | use RDF::DOAP::Types -types; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | |||||||||||||||
| 12 | 1 | ▶ | use RDF::Trine::Namespace qw(rdf rdfs owl xsd); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 13 | 1 | my $doap = 'RDF::Trine::Namespace'->new('http://usefulinc.com/ns/doap#'); | |||||||||||||
| 14 | 1 | my $dc = 'RDF::Trine::Namespace'->new('http://purl.org/dc/terms/'); | |||||||||||||
| 15 | 1 | my $dcs = 'RDF::Trine::Namespace'->new('http://ontologi.es/doap-changeset#'); | |||||||||||||
| 16 | |||||||||||||||
| 17 | 1 | has fixes => ( | |||||||||||||
| 18 | is => 'ro', | ||||||||||||||
| 19 | isa => ArrayRef[Issue], | ||||||||||||||
| 20 | coerce => 1, | ||||||||||||||
| 21 | lazy => 1, | ||||||||||||||
| 22 | builder => '_build_fixes', | ||||||||||||||
| 23 | ); | ||||||||||||||
| 24 | |||||||||||||||
| 25 | sub _build_fixes | ||||||||||||||
| 26 | 4 | ▶ | { | ||||||||||||
|
Subroutine
_build_fixes: called CC=3 SCAR=11.3
| |||||||||||||||
| 27 | 4 | my $self = shift; | |||||||||||||
| 28 | 4 | ▶ | return [] unless $self->has_rdf_about; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 29 | 4 | ▶ | return [] unless $self->has_rdf_model; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 30 | |||||||||||||||
| 31 | 4 | my $model = $self->rdf_model; | |||||||||||||
| 32 | 4 | [ map 'RDF::DOAP::Issue'->rdf_load($_, $model), $model->objects($self->rdf_about, $dcs->fixes) ]; | |||||||||||||
| 33 | } | ||||||||||||||
| 34 | |||||||||||||||
| 35 | override changelog_links => sub | ||||||||||||||
| 36 | 4 | ▶ | { | ||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||
| 37 | 4 | my $self = shift; | |||||||||||||
| 38 | my @pages = map { | ||||||||||||||
| 39 | 2 | my $bug = $_; | |||||||||||||
| 40 | 2 | ▶ | grep defined, $bug->page, @{ $bug->see_also || [] }; | ||||||||||||
|
Condition50%1/2
$bug->see_also || []
MC/DC0%0/1
$bug->see_also || []
$bug->see_also
Truth table50%1/2
A
A= $bug->see_also
| |||||||||||||||
| 41 | 4 | } @{ $self->fixes }; | |||||||||||||
| 42 | 4 | return (@pages, super()); | |||||||||||||
| 43 | 1 | }; | |||||||||||||
| 44 | |||||||||||||||
| 45 | 1 | my %ABBREV = ( | |||||||||||||
| 46 | GITHUB => 'GH', | ||||||||||||||
| 47 | RT => 'RT', | ||||||||||||||
| 48 | ); | ||||||||||||||
| 49 | override changelog_lines => sub | ||||||||||||||
| 50 | 4 | ▶ | { | ||||||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=14.0
| |||||||||||||||
| 51 | 4 | my $self = shift; | |||||||||||||
| 52 | 4 | my @lines = super(); | |||||||||||||
| 53 | my @added = map { | ||||||||||||||
| 54 | 2 | ▶ | !defined($_->id) ? () : | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 55 | ($_->rdf_about =~ /\b(RT|GITHUB)\b/i) ? "Fixes $ABBREV{uc($1)}#$_->{id}." : | ||||||||||||||
| 56 | "Fixes #$_->{id}." | ||||||||||||||
| 57 | 4 | } @{ $self->fixes }; | |||||||||||||
| 58 | 4 | ▶ | splice(@lines, 1, 0, @added) if @added; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 59 | 4 | return @lines; | |||||||||||||
| 60 | 1 | }; | |||||||||||||
| 61 | |||||||||||||||
| 62 | 1 | 1; | |||||||||||||