blib/lib/Text/Trac/LinkResolver/Comment.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 2 / 4 Conditioncond 40.0% 2 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 75.6% 31 / 41 SCAR 16.3
CC
5
Cov
84%
format_link
5.5
BEGIN
1.0
BEGIN
1.0
CRAP 5.1
« blib/lib/Text/Trac.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Attachment.pm »
1 package Text::Trac::LinkResolver::Comment;
2  
3 48 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 48 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 48 ▶use base qw( Text::Trac::LinkResolver );
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 48 our $VERSION = '0.23';
8  
9 sub init {
10 5462 ▶ my $self = shift;
Subroutine init: called CC=1 SCAR=0.0
Pod undocumented
11 5462 $self->{pattern} = '!?(?<!&)comment:ticket:\d+:\d+';
12 }
13  
14 sub format_link {
15 1 ▶ my ( $self, $match, $target, $label ) = @_;
Subroutine format_link: called CC=5 SCAR=17.1
Pod undocumented
16 1 ▶ return $match if $self->_is_disabled;
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_disabled 0 1 1
17  
18 1 my $c = $self->{context};
19 1 ▶ $label ||= $match;
Condition33%1/3
$label ||= $match
l!l&&r!l&&!r
010
MC/DC0%0/2
$label ||= $match
$label $match
Truth table33%1/3
A ||= B
A= $labelB= $match
ABresult
1X1
011
000
20 1 my ( $rev, $commentId ) = ( $match =~ m/(\d+):(\d+)/ );
21  
22 1 ▶ my $url = $c->{trac_ticket_url} || $c->trac_url . 'ticket/';
Condition50%1/2
$c->{'trac_ticket_url'} || $c->trac_url . 'ticket/'
l!l
01
MC/DC0%0/1
$c->{'trac_ticket_url'} || $c->trac_url . 'ticket/'
$c->{'trac_ticket_url'}
Truth table50%1/2
A
A= $c->{'trac_ticket_url'}
Aresult
11
00
23 1 $url .= $rev;
24 1 $url .= "#comment:$commentId";
25 1 ▶ return sprintf '<a %s href="%s">%s</a>', ( $c->{class} ? q{class="ticket"} : '' ), $url, $label;
Branch: 1 branch
BranchTrueFalseTotal
$c->{'class'} ? : 1 0 1
26 }
27  
28 48 1;
« blib/lib/Text/Trac.pm ↑ Summary blib/lib/Text/Trac/LinkResolver/Attachment.pm »