inc/Module/Install/GithubMeta.pm

filter: Statementstmt 36.1% 17 / 47 Branchbran 0.0% 0 / 20 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 28.2% 22 / 78 CC 12 SCAR 37.0
CC
12
Cov
25%
githubmeta
72.0
_under_git
30.0
BEGIN
1.0
CRAP 40.6
« inc/Module/Install/Metadata.pm ↑ Summary dist/t9vPd3GCmf/Foo-Bar-0.01/inc/Module/Install/Can.pm »
1 #line 1
2 package Module::Install::GithubMeta;
3 5 ▶ 
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use Cwd;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use base qw(Module::Install::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 use vars qw($VERSION);
9 5  
10 $VERSION = '0.30';
11 0 ▶ 
Subroutine githubmeta: not called CC=8 SCAR=42.8
Pod undocumented
12 0 sub githubmeta {
13 0 ▶ my $self = shift;
Branch: 1 branch
BranchTrueFalseTotal
unless $Module::Install::AUTHOR 0 0 0
14 0 ▶ return unless $Module::Install::AUTHOR;
Branch: 1 branch
BranchTrueFalseTotal
unless _under_git() 0 0 0
15 0 ▶ return unless _under_git();
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can_run("git") 0 0 0
16 0 ▶ return unless $self->can_run('git');
Condition0%0/2
shift() || 'origin'
l!l
00
MC/DC0%0/1
shift() || 'origin'
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
17 0 my $remote = shift || 'origin';
18 0 local $ENV{LC_ALL}='C';
19 0 ▶ local $ENV{LANG}='C';
Branch: 1 branch
BranchTrueFalseTotal
unless my($git_url) = `git remote show -n $remote` =~ /URL: (.*)$/m 0 0 0
20 0 ▶ return unless my ($git_url) = `git remote show -n $remote` =~ /URL: (.*)$/m;
Branch: 1 branch
BranchTrueFalseTotal
unless $git_url =~ /github\.com/ 0 0 0
21 0 return unless $git_url =~ /github\.com/; # Not a Github repository
22 0 my $http_url = $git_url;
23 0 $git_url =~ s![\w\-]+\@([^:]+):!git://$1/!;
24 0 $http_url =~ s![\w\-]+\@([^:]+):!https://$1/!;
25 0 $http_url =~ s!\.git$!/!;
26 0 ▶ $self->repository( $git_url );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->homepage 0 0 0
27 0 $self->homepage( $http_url ) unless $self->homepage();
28 return 1;
29 }
30 0 ▶ 
Subroutine _under_git: not called CC=5 SCAR=34.0
31 0 ▶sub _under_git {
Branch: 1 branch
BranchTrueFalseTotal
if -e ".git" 0 0 0
32 0 return 1 if -e '.git';
33 0 my $cwd = getcwd;
34 0 my $last = $cwd;
35 0 my $found = 0;
36 0 ▶ while (1) {
Branch: 1 branch
BranchTrueFalseTotal
chdir ".." or last 0 0 0
37 0 chdir '..' or last;
38 0 ▶ my $current = getcwd;
Branch: 1 branch
BranchTrueFalseTotal
if $last eq $current 0 0 0
39 0 last if $last eq $current;
40 0 ▶ $last = $current;
Branch: 1 branch
BranchTrueFalseTotal
if (-e ".git") 0 0 0
41 0 if ( -e '.git' ) {
42 0 $found = 1;
43 last;
44 }
45 0 }
46 0 chdir $cwd;
47 return $found;
48 }
49 5  
50 'Github';
51 __END__
« inc/Module/Install/Metadata.pm ↑ Summary dist/t9vPd3GCmf/Foo-Bar-0.01/inc/Module/Install/Can.pm »