| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package GitHub::MergeVelocity::Repository::Statistics; |
|
2
|
|
|
|
|
|
|
$GitHub::MergeVelocity::Repository::Statistics::VERSION = '0.000007'; |
|
3
|
3
|
|
|
3
|
|
60927
|
use strict; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
131
|
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
108
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
432
|
use Math::Round qw( nearest round ); |
|
|
3
|
|
|
|
|
6190
|
|
|
|
3
|
|
|
|
|
206
|
|
|
7
|
3
|
|
|
3
|
|
559
|
use Moo; |
|
|
3
|
|
|
|
|
12630
|
|
|
|
3
|
|
|
|
|
19
|
|
|
8
|
3
|
|
|
3
|
|
2581
|
use Types::Standard qw( Bool Int ); |
|
|
3
|
|
|
|
|
54247
|
|
|
|
3
|
|
|
|
|
32
|
|
|
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
|
12156
|
my $self = shift; |
|
52
|
2
|
|
|
|
|
5
|
my $state = shift; |
|
53
|
|
|
|
|
|
|
|
|
54
|
2
|
|
|
|
|
5
|
my $method = $state . '_age'; |
|
55
|
2
|
50
|
|
|
|
17
|
return $self->$method |
|
56
|
|
|
|
|
|
|
? round( $self->$method / $self->$state ) |
|
57
|
|
|
|
|
|
|
: 0; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub percentage_in_state { |
|
61
|
5
|
|
|
5
|
0
|
4945
|
my $self = shift; |
|
62
|
5
|
|
|
|
|
10
|
my $state = shift; |
|
63
|
5
|
50
|
|
|
|
94
|
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.000007 |
|
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 |