lib/App/gh/Command/Info.pm

filter: Statementstmt 54.2% 19 / 35 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 43.1% 25 / 58 CC 5 SCAR 16.2
CC
5
Cov
43%
parse_uri
12.0
get_remote
6.0
run
6.0
CRAP 5.1
« blib/lib/App/gh/Command/Page.pm ↑ Summary blib/lib/App/gh/Command/Recent.pm »
1 package App::gh::Command::Info;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base qw(App::gh::Command);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use App::gh;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use App::gh::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub parse_uri {
Subroutine parse_uri: not called CC=3 SCAR=24.8
Pod undocumented
10 0 my ($uri) = @_;
11 0 ▶ if ( $uri =~ m{(git|https?)://github.com/(.*?)/(.*?).git} ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($uri =~ m[(git|https?)://github.com/(.*?)/(.*?).git]) { } 0 0 0
elsif ($uri =~ m[git\@github.com:(.*?)/(.*?).git]) { } 0 0 0
12 0 return ($2,$3,$1);
13 } elsif ( $uri =~ m{git\@github.com:(.*?)/(.*?).git} ) {
14 0 return ($1,$2,'git');
15 }
16 0 return undef;
17 }
18  
19 0 ▶sub get_remote {
Subroutine get_remote: not called CC=2 SCAR=17.9
Pod undocumented
20 0 my $self = shift;
21 0 my $config = App::gh->config->current();
22 0 my %remotes = %{ $config->{remote} };
23 # try to get origin remote
24 0 ▶ return $remotes{origin} || (values( %remotes ))[0];
Condition0%0/3
$remotes{'origin'} || (values %remotes)[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
$remotes{'origin'} || (values %remotes)[0]
$remotes{'origin'} (values %remotes)[0]
Truth table0%0/3
A || B
A= $remotes{'origin'}B= (values %remotes)[0]
ABresult
1X1
011
000
25 }
26  
27 0 ▶sub run {
Subroutine run: not called CC=2 SCAR=17.9
Pod undocumented
28 0 my $self = shift;
29 # my $gh_id = App::gh->config->github_id();
30 0 my $remote = $self->get_remote();
31 0 ▶ die "Remote not found\n." unless $remote;
Branch: 1 branch
BranchTrueFalseTotal
unless $remote 0 0 0
32 0 my ( $user, $repo, $uri_type ) = parse_uri( $remote->{url} );
33 0 my $ret = App::gh->api->repo_info( $user, $repo );
34 0 App::gh::Utils->print_repo_info( $ret );
35 }
36  
37  
38 1 1;
39 __END__
« blib/lib/App/gh/Command/Page.pm ↑ Summary blib/lib/App/gh/Command/Recent.pm »