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

moosetechnology / GitProjectHealth / 13632678830

03 Mar 2025 02:03PM UTC coverage: 64.16% (+1.4%) from 62.725%
13632678830

push

github

web-flow
Merge pull request #137 from moosetechnology/Opened-MergeRerquest-Duration-Project-metric

merge request duration project metric

688 of 716 new or added lines in 14 files covered. (96.09%)

1 existing line in 1 file now uncovered.

10648 of 16596 relevant lines covered (64.16%)

0.64 hits per line

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

0.0
/src/GitLabHealth-Model-Analysis/DelayUntilFirstChurnMetric.class.st
1
Class {
2
        #name : #DelayUntilFirstChurnMetric,
3
        #superclass : #UserCommitsMetric,
4
        #instVars : [
5
                'maxCommitWindow'
6
        ],
7
        #category : #'GitLabHealth-Model-Analysis'
8
}
9

10
{ #category : #calculating }
11
DelayUntilFirstChurnMetric >> calculate [
×
12

×
13
        | commits groupedByDate res average |
×
14
        userCommits ifNil: [ self load ].
×
15
        groupedByDate := self setupGroupedDate.
×
16
        commits := self
×
17
                           foundSuccessorOf: userCommits
×
18
                           andCompleteImportForMax: maxCommitWindow.
×
19

×
20

×
21
        "class commit by dates, filter none user commits"
×
22
        commits do: [ :commit |
×
23
                commit commitCreator = user ifTrue: [
×
24
                        | overDate |
×
25
                        overDate := self transformDate: commit created_at to: over.
×
26

×
27
                        groupedByDate
×
28
                                at: overDate printString
×
29
                                ifPresent: [ :arrayOfCommits | arrayOfCommits add: commit ]
×
NEW
30
 ] ].
×
31

×
32

×
33

×
34
        res := groupedByDate collect: [ :commits4Date |
×
35
                       | durationFromA2B |
×
36
                       commits4Date collect: [ :commitA |
×
37
                               | commitB |
×
38
                               commitB := GitAnalyzer new
×
39
                                                  fromCommit: commitA;
×
40
                                                  maxChildCommit: maxCommitWindow;
×
41
                                                  analyseDelayUntilFirstChurn.
×
42

×
43
                               durationFromA2B := commitB
×
44
                                                          ifNil: [ 0 ]
×
45
                                                          ifNotNil: [
×
46
                                                          commitB created_at - commitA created_at ].
×
47
                               durationFromA2B ] ].
×
48

×
49

×
50

×
51
        res := res collect: [ :durationsByDate |
×
52
                       | filtered |
×
53
                       filtered := durationsByDate reject: [ :value | value = 0 ].
×
54
                       filtered isEmpty
×
55
                               ifTrue: [ nil ]
×
56
                               ifFalse: [
×
57
                               (filtered sum: [ :v | v asDuration asSeconds ])
×
58
                               / filtered size ] ].
×
59

×
60
        res := res reject: #isNil.
×
61

×
62
        average := res
×
63
                           ifEmpty: [ nil ]
×
64
                           ifNotEmpty: [ res values average asFloat ].
×
65

×
66
        ^ average
×
67
]
×
68

69
{ #category : #accessing }
70
DelayUntilFirstChurnMetric >> description [
×
71

×
72
        ^ 'delay Until First Churn (W=' , maxCommitWindow printString
×
73
                           , ')'
×
74
]
×
75

76
{ #category : #initialization }
77
DelayUntilFirstChurnMetric >> initialize [
×
78
        super initialize.
×
79
        maxCommitWindow := 3
×
80
]
×
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

© 2026 Coveralls, Inc