• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / GitProjectHealth / 10735005631

06 Sep 2024 08:21AM UTC coverage: 18.144%. First build
10735005631

Pull #51

github

web-flow
Merge 1a2ec4468 into a41e8af49
Pull Request #51: refactor: change duration for seconds in metrics

0 of 24 new or added lines in 3 files covered. (0.0%)

1590 of 8763 relevant lines covered (18.14%)

0.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/GitLabHealth-Model-Analysis/TimeBetweenCommitMetric.class.st
1
Class {
2
        #name : #TimeBetweenCommitMetric,
3
        #superclass : #UserCommitsMetric,
4
        #category : #'GitLabHealth-Model-Analysis'
5
}
6

7
{ #category : #calculating }
8
TimeBetweenCommitMetric >> calculate [
×
9

×
10
        | commitSortedByDate commits1 commits2 differences groupedByDate dateOver average |
×
11
        userCommits ifNil: [ self load ].
×
12
        groupedByDate := self setupGroupedDate.
×
13

×
14
        commitSortedByDate := userCommits sorted: [ :commit1 :commit2 |
×
15
                                      commit1 committed_date
×
16
                                      < commit2 committed_date ].
×
17

×
18
        commitSortedByDate do: [ :commit |
×
19
                dateOver := self transformDate: commit committed_date to: over.
×
20

×
21
                groupedByDate
×
22
                        at: dateOver printString
×
23
                        ifPresent: [ :value | value add: commit ] ].
×
24

×
25
        groupedByDate := groupedByDate select: [ :group | group size >= 2 ].
×
26

×
27

×
28
        groupedByDate := groupedByDate collect: [ :group |
×
29
                                 differences := (1 to: group size - 1) collect: [ :i |
×
30
                                                        commits1 := group at: i.
×
31
                                                        commits2 := group at: i + 1.
×
32

×
33
                                                        (commits2 committed_date
×
34
                                                         - commits1 committed_date)
×
35
                                                                asSeconds ].
×
NEW
36
                        
×
37

×
NEW
38
                                 differences average asFloat ].
×
39

×
40
        average := groupedByDate
×
41
                           ifEmpty: [ nil ]
×
42
                           ifNotEmpty: [ groupedByDate average ].
×
43

×
44
        ^ average
×
45
]
×
46

47
{ #category : #accessing }
48
TimeBetweenCommitMetric >> description [
×
49

×
NEW
50
        ^ 'average time between commits (in seconds)'
×
51
]
×
52

53
{ #category : #accessing }
54
TimeBetweenCommitMetric >> name [
×
55

×
56
        ^ 'timeBetweenCommit'
×
57
]
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc