line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use Moo; |
2
|
3
|
|
|
3
|
|
138518
|
|
|
3
|
|
|
|
|
10102
|
|
|
3
|
|
|
|
|
17
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.000009'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use DateTime (); |
6
|
3
|
|
|
3
|
|
4456
|
use GitHub::MergeVelocity::Types qw( Datetime ); |
|
3
|
|
|
|
|
1430619
|
|
|
3
|
|
|
|
|
150
|
|
7
|
3
|
|
|
3
|
|
1663
|
use Math::Round qw( round ); |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
39
|
|
8
|
3
|
|
|
3
|
|
2245
|
use MooX::StrictConstructor; |
|
3
|
|
|
|
|
2109
|
|
|
3
|
|
|
|
|
191
|
|
9
|
3
|
|
|
3
|
|
1144
|
use Types::Standard qw( Bool Int Str ); |
|
3
|
|
|
|
|
18375
|
|
|
3
|
|
|
|
|
18
|
|
10
|
3
|
|
|
3
|
|
39747
|
|
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
29
|
|
11
|
|
|
|
|
|
|
has age => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
init_arg => undef, |
14
|
|
|
|
|
|
|
isa => Int, |
15
|
|
|
|
|
|
|
lazy => 1, |
16
|
|
|
|
|
|
|
builder => '_build_age', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has closed_at => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => Datetime, |
22
|
|
|
|
|
|
|
predicate => 'is_closed', |
23
|
|
|
|
|
|
|
coerce => 1, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has created_at => ( |
27
|
|
|
|
|
|
|
is => 'ro', |
28
|
|
|
|
|
|
|
isa => Datetime, |
29
|
|
|
|
|
|
|
predicate => 'has_created_at', |
30
|
|
|
|
|
|
|
coerce => 1, |
31
|
|
|
|
|
|
|
required => 1, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has is_work_in_progress => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => Bool, |
37
|
|
|
|
|
|
|
lazy => 1, |
38
|
|
|
|
|
|
|
default => sub { |
39
|
|
|
|
|
|
|
return shift->title =~ m{\A\[?WIP\]?}; |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has merged_at => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
isa => Datetime, |
46
|
|
|
|
|
|
|
predicate => 'is_merged', |
47
|
|
|
|
|
|
|
coerce => 1, |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has number => ( |
51
|
|
|
|
|
|
|
is => 'ro', |
52
|
|
|
|
|
|
|
isa => Int, |
53
|
|
|
|
|
|
|
required => 1, |
54
|
|
|
|
|
|
|
documentation => 'issue number in the GitHub url' |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
has title => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
isa => Str, |
60
|
|
|
|
|
|
|
required => 1, |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has state => ( |
64
|
|
|
|
|
|
|
is => 'ro', |
65
|
|
|
|
|
|
|
isa => Str, |
66
|
|
|
|
|
|
|
init_arg => undef, |
67
|
|
|
|
|
|
|
lazy => 1, |
68
|
|
|
|
|
|
|
builder => '_build_state', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has velocity => ( |
72
|
|
|
|
|
|
|
is => 'ro', |
73
|
|
|
|
|
|
|
isa => Int, |
74
|
|
|
|
|
|
|
init_arg => undef, |
75
|
|
|
|
|
|
|
lazy => 1, |
76
|
|
|
|
|
|
|
builder => '_build_velocity', |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $self = shift; |
80
|
|
|
|
|
|
|
return $self->state eq 'open'; |
81
|
26
|
|
|
26
|
0
|
40
|
} |
82
|
26
|
|
|
|
|
350
|
|
83
|
|
|
|
|
|
|
my $self = shift; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
my $upper_bound |
86
|
28
|
|
|
28
|
|
2459
|
= $self->is_merged ? $self->merged_at |
87
|
|
|
|
|
|
|
: $self->is_closed ? $self->closed_at |
88
|
28
|
100
|
|
|
|
117
|
: DateTime->now; |
|
|
100
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
return $upper_bound->delta_days( $self->created_at )->delta_days; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
28
|
|
|
|
|
1273
|
my $self = shift; |
94
|
|
|
|
|
|
|
return |
95
|
|
|
|
|
|
|
$self->is_merged ? 'merged' |
96
|
|
|
|
|
|
|
: $self->is_closed ? 'closed' |
97
|
26
|
|
|
26
|
|
8514
|
: 'open'; |
98
|
|
|
|
|
|
|
} |
99
|
26
|
100
|
|
|
|
381
|
|
|
|
100
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# add points for merges in the first 30 days |
101
|
|
|
|
|
|
|
# merges in 31 - 45 are neutral |
102
|
|
|
|
|
|
|
# subtract after 45 days |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
my $self = shift; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
return 0 if $self->is_work_in_progress; |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
if ( $self->is_open ) { |
109
|
28
|
|
|
28
|
|
3348
|
return $self->age > 45 ? 45 - $self->age : 0; |
110
|
|
|
|
|
|
|
} |
111
|
28
|
100
|
|
|
|
357
|
|
112
|
|
|
|
|
|
|
my $score = 0; |
113
|
26
|
100
|
|
|
|
483
|
if ( $self->age < 31 ) { |
114
|
3
|
100
|
|
|
|
59
|
$score += round( 1.2**( 31 - $self->age ) ); |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
elsif ( $self->age > 45 ) { |
117
|
23
|
|
|
|
|
204
|
$score = 45 - $self->age; |
118
|
23
|
100
|
|
|
|
294
|
} |
|
|
100
|
|
|
|
|
|
119
|
20
|
|
|
|
|
763
|
return $score; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
2
|
|
|
|
|
80
|
1; |
123
|
|
|
|
|
|
|
|
124
|
23
|
|
|
|
|
671
|
=pod |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=encoding UTF-8 |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 NAME |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
GitHub::MergeVelocity::Repository::PullRequest - Encapsulate select data about GitHub pull requests |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head1 VERSION |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
version 0.000009 |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 AUTHOR |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Olaf Alders <olaf@wundercounter.com> |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Olaf Alders. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
145
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# ABSTRACT: Encapsulate select data about GitHub pull requests |