line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GitHub::MergeVelocity::Repository::Statistics; |
2
|
|
|
|
|
|
|
$GitHub::MergeVelocity::Repository::Statistics::VERSION = '0.000006'; |
3
|
3
|
|
|
3
|
|
89099
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
127
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
105
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
663
|
use Math::Round qw( nearest round ); |
|
3
|
|
|
|
|
9303
|
|
|
3
|
|
|
|
|
211
|
|
7
|
3
|
|
|
3
|
|
723
|
use Moo; |
|
3
|
|
|
|
|
18132
|
|
|
3
|
|
|
|
|
20
|
|
8
|
3
|
|
|
3
|
|
3270
|
use Types::Standard qw( Bool Int ); |
|
3
|
|
|
|
|
80964
|
|
|
3
|
|
|
|
|
36
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has average_velocity => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
isa => Int, |
13
|
|
|
|
|
|
|
lazy => 1, |
14
|
|
|
|
|
|
|
default => sub { |
15
|
|
|
|
|
|
|
my $self = shift; |
16
|
|
|
|
|
|
|
return $self->pull_request_count |
17
|
|
|
|
|
|
|
? round( $self->total_velocity / $self->pull_request_count ) |
18
|
|
|
|
|
|
|
: 0; |
19
|
|
|
|
|
|
|
}, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has [ 'closed', 'open', 'merged', ] => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => Int, |
25
|
|
|
|
|
|
|
default => 0, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has [ 'closed_age', 'open_age', 'merged_age' ] => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => Int, |
31
|
|
|
|
|
|
|
default => 0, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has pull_request_count => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => Int, |
37
|
|
|
|
|
|
|
lazy => 1, |
38
|
|
|
|
|
|
|
default => sub { |
39
|
|
|
|
|
|
|
my $self = shift; |
40
|
|
|
|
|
|
|
return $self->closed + $self->open + $self->merged; |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
); |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has total_velocity => ( |
45
|
|
|
|
|
|
|
is => 'ro', |
46
|
|
|
|
|
|
|
isa => Int, |
47
|
|
|
|
|
|
|
required => 1, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub average_age_for_state { |
51
|
2
|
|
|
2
|
0
|
12415
|
my $self = shift; |
52
|
2
|
|
|
|
|
4
|
my $state = shift; |
53
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
4
|
my $method = $state . '_age'; |
55
|
2
|
50
|
|
|
|
15
|
return $self->$method |
56
|
|
|
|
|
|
|
? round( $self->$method / $self->$state ) |
57
|
|
|
|
|
|
|
: 0; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub percentage_in_state { |
61
|
5
|
|
|
5
|
0
|
5034
|
my $self = shift; |
62
|
5
|
|
|
|
|
9
|
my $state = shift; |
63
|
5
|
50
|
|
|
|
84
|
return $self->pull_request_count |
64
|
|
|
|
|
|
|
? nearest( 0.01, $self->$state / $self->pull_request_count ) |
65
|
|
|
|
|
|
|
: 0; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=pod |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=encoding UTF-8 |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
GitHub::MergeVelocity::Repository::Statistics - Pull request statistics for a given repository |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version 0.000006 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 AUTHOR |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Olaf Alders <olaf@wundercounter.com> |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Olaf Alders. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
91
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=cut |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
__END__ |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
# ABSTRACT: Pull request statistics for a given repository |