lib/App/gh/Command/Network.pm

filter: Statementstmt 55.1% 16 / 29 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 55.5% 5 / 9 Podpod 0.0% 0 / 4 totaltotal 35.5% 21 / 59 CC 7 SCAR 25.6
CC
7
Cov
38%
get_networks
30.0
run
12.0
options
2.0
CRAP 13.0
« lib/App/gh/Command/Pullreq/List.pm ↑ Summary blib/lib/App/gh/Command/Upload.pm »
1 package App::gh::Command::Network;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw(App::gh::Command);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use App::gh;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use App::gh::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 App::gh::Command::Network - show network
11  
12 =head1 USAGE
13  
14 $ cd App-gh
15 $ gh network
16  
17 =cut
18  
19  
20 0 ▶sub options { (
Subroutine options: not called CC=1 SCAR=6.9
Pod undocumented
21 0 'i|id' => 'id_only', # id only
22 ) }
23  
24 0 ▶sub require_local_gitconfig { 1 }
Subroutine require_local_gitconfig: not called CC=1 SCAR=6.9
Pod undocumented
25  
26  
27  
28 0 ▶sub get_networks {
Subroutine get_networks: not called CC=5 SCAR=34.0
Pod undocumented
29 0 my $config = App::gh->config->current();
30 0 my ( $name, $url ) = split( /\s+/, qx( git remote -v | grep origin | grep push ) );
31  
32 # git://github.com/miyagawa/Tatsumaki.git
33 # -or-
34 # https://github.com/miyagawa/Tatsumaki.git
35 0 ▶ if ( $url && ( $url =~ m{git://github.com/(.*?)/(.*?)\.git}
Branch: 1 branch
BranchTrueFalseTotal
if ($url and $url =~ m[git://github.com/(.*?)/(.*?)\.git] || $url =~ m[git\@github.com:(.*?)/(.*?)\.git] || $url =~ m[https://github.com/(.*?)/(.*?)\.git]) 0 0 0
Condition0%0/9
$url and $url =~ m[git://github.com/(.*?)/(.*?)\.git] || $url =~ m[git\@github.com:(.*?)/(.*?)\.git] || $url =~ m[https://github.com/(.*?)/(.*?)\.git]
!ll&&!rl&&r
000
$url =~ m[git://github.com/(.*?)/(.*?)\.git] or $url =~ m[git\@github.com:(.*?)/(.*?)\.git] or $url =~ m[https://github.com/(.*?)/(.*?)\.git]
l!l&&r!l&&!r
000
$url =~ m[git://github.com/(.*?)/(.*?)\.git] or $url =~ m[git\@github.com:(.*?)/(.*?)\.git]
l!l&&r!l&&!r
000
MC/DC0%0/4
$url and $url =~ m[git://github.com/(.*?)/(.*?)\.git] || $url =~ m[git\@github.com:(.*?)/(.*?)\.git] || $url =~ m[https://github.com/(.*?)/(.*?)\.git]
$url $url =~ m[git://github.com/(.*?)/(.*?)\.git] $url =~ m[git\@github.com:(.*?)/(.*?)\.git] $url =~ m[https://github.com/(.*?)/(.*?)\.git]
Truth table0%0/5
A and B or C or D
A= $urlB= $url =~ m[git://github.com/(.*?)/(.*?)\.git]C= $url =~ m[git\@github.com:(.*?)/(.*?)\.git]D= $url =~ m[https://github.com/(.*?)/(.*?)\.git]
ABCDresult
0XXX0
10000
11XX1
101X1
10011
36 || $url =~ m{git\@github.com:(.*?)/(.*?)\.git}
37 || $url =~ m{https://github.com/(.*?)/(.*?)\.git} ) ) {
38  
39 0 my ( $acc, $repo ) = ( $1, $2 );
40 0 return App::gh->api->repo_network( $acc , $repo );
41 }
42 }
43  
44 0 ▶sub run {
Subroutine run: not called CC=3 SCAR=24.8
Pod undocumented
45 0 my $self = shift;
46 0 my $networks = $self->get_networks;
47 0 for my $net ( @$networks ) {
48 0 ▶ if( $self->{id_only} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'id_only'}) { } 0 0 0
49 0 print $net->{owner} . "\n";
50 }
51 else {
52 printf( "% 17s - watchers(%d) forks(%d)\n"
53 , $net->{owner} . '/' . $net->{name}
54 , $net->{watchers}
55 , $net->{forks}
56 0 );
57 }
58 }
59 }
60  
61 1 1;
« lib/App/gh/Command/Pullreq/List.pm ↑ Summary blib/lib/App/gh/Command/Upload.pm »