blib/lib/Swim/Plugin/badge.pm

filter: Statementstmt 100% 45 / 45 Branchbran 50.0% 12 / 24 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 6 totaltotal 78.8% 67 / 85 CC 15 SCAR 13.9
CC
15
Cov
83%
phrase_func_badge
6.3
phrase_func_badge
6.3
phrase_func_badge_travis
2.0
CRAP 4.0
↑ Summary
1 package Swim::Plugin::badge;
2 2 our $VERSION = '0.1.8';
3  
4 package Swim::Pod;
5  
6 1 ▶sub phrase_func_badge {
Subroutine phrase_func_badge: called CC=6 SCAR=18.5
Pod undocumented
7 1 my ($self, $args) = @_;
8 1 my @args = split / +/, $args;
9 1 ▶ $args = pop @args or return;
Branch: 1 branch
BranchTrueFalseTotal
$args = pop @args or return 1 0 1
10 1 ▶ return unless @args;
Branch: 1 branch
BranchTrueFalseTotal
unless @args 0 1 1
11 1 ▶ return unless $args =~ /^(\S+)\/(\S+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args =~ m[^(\S+)/(\S+)$] 0 1 1
12 1 my $out = "=for html\n";
13 1 for my $type (@args) {
14 2 my $method = "_badge_$type";
15 2 ▶ if ($self->can($method)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can($method)) 2 0 2
16 2 $out .= $self->$method($1, $2) . "\n";
17 }
18 }
19 1 return "$out\n";
20 }
21  
22 1 ▶sub phrase_func_badge_travis {
Subroutine phrase_func_badge_travis: called CC=2 SCAR=7.1
Pod undocumented
23 1 my ($self, $args) = @_;
24 1 ▶ return unless $args =~ /^(\S+)\/(\S+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args =~ m[^(\S+)/(\S+)$] 0 1 1
25 1 sprintf "=for html\n%s\n\n", $self->_badge_travis($1, $2);
26 }
27  
28 1 ▶sub phrase_func_badge_coveralls {
Subroutine phrase_func_badge_coveralls: called CC=2 SCAR=7.1
Pod undocumented
29 1 my ($self, $args) = @_;
30 1 ▶ return unless $args =~ /^(\S+)\/(\S+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args =~ m[^(\S+)/(\S+)$] 0 1 1
31 1 sprintf "=for html\n%s\n\n", $self->_badge_coveralls($1, $2);
32 }
33  
34 2 ▶sub _badge_travis {
Subroutine _badge_travis: called CC=1 SCAR=0.0
35 2 my ($self, $owner, $repo) = @_;
36 2 qq{<a href="https://travis-ci.org/$owner/$repo"><img src="https://travis-ci.org/$owner/$repo.png" alt="$repo"></a>};
37 }
38  
39 2 ▶sub _badge_coveralls {
Subroutine _badge_coveralls: called CC=1 SCAR=0.0
40 2 my ($self, $owner, $repo) = @_;
41 2 qq{<a href="https://coveralls.io/r/$owner/$repo?branch=master"><img src="https://coveralls.io/repos/$owner/$repo/badge.png" alt="$repo"></a>};
42 }
43  
44 package Swim::Markdown;
45  
46 1 ▶sub phrase_func_badge {
Subroutine phrase_func_badge: called CC=6 SCAR=18.4
Pod undocumented
47 1 my ($self, $args) = @_;
48 1 my @args = split / +/, $args;
49 1 ▶ $args = pop @args or return;
Branch: 1 branch
BranchTrueFalseTotal
$args = pop @args or return 1 0 1
50 1 ▶ return unless @args;
Branch: 1 branch
BranchTrueFalseTotal
unless @args 0 1 1
51 1 ▶ return unless $args =~ /^(\S+)\/(\S+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args =~ m[^(\S+)/(\S+)$] 0 1 1
52 1 my $out = "";
53 1 for my $type (@args) {
54 2 my $method = "_badge_$type";
55 2 ▶ if ($self->can($method)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can($method)) 2 0 2
56 2 $out .= $self->$method($1, $2) . "\n";
57 }
58 }
59 1 chomp $out;
60 1 return $out;
61 }
62  
63 1 ▶sub phrase_func_badge_travis {
Subroutine phrase_func_badge_travis: called CC=2 SCAR=7.1
Pod undocumented
64 1 my ($self, $args) = @_;
65 1 ▶ return unless $args =~ /^(\S+)\/(\S+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args =~ m[^(\S+)/(\S+)$] 0 1 1
66 1 $self->_badge_travis($1, $2);
67 }
68  
69 1 ▶sub phrase_func_badge_coveralls {
Subroutine phrase_func_badge_coveralls: called CC=2 SCAR=7.1
Pod undocumented
70 1 my ($self, $args) = @_;
71 1 ▶ return unless $args =~ /^(\S+)\/(\S+)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $args =~ m[^(\S+)/(\S+)$] 0 1 1
72 1 $self->_badge_coveralls($1, $2);
73 }
74  
75 2 ▶sub _badge_travis {
Subroutine _badge_travis: called CC=1 SCAR=0.0
76 2 my ($self, $owner, $repo) = @_;
77 2 qq{[![Travis build status](https://travis-ci.org/$owner/$repo.png?branch=master)](https://travis-ci.org/$owner/$repo)};
78 }
79  
80 2 ▶sub _badge_coveralls {
Subroutine _badge_coveralls: called CC=1 SCAR=0.0
81 2 my ($self, $owner, $repo) = @_;
82 2 qq{[![Coverage Status](https://coveralls.io/repos/$owner/$repo/badge.png?branch=master)](https://coveralls.io/r/$owner/$repo?branch=master)};
83 }
84  
85 2 1;
↑ Summary