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

moosetechnology / GitProjectHealth / 11667512120

04 Nov 2024 03:36PM UTC coverage: 59.207% (+0.2%) from 59.01%
11667512120

Pull #105

github

web-flow
Merge 0462ff346 into 3c4574e31
Pull Request #105: fix/add email user to the importer + tests

71 of 82 new or added lines in 3 files covered. (86.59%)

149 existing lines in 35 files now uncovered.

9582 of 16184 relevant lines covered (59.21%)

0.59 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 }
UNCOV
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 ]
×
30
                                ifAbsentPut: [
×
31
                                        OrderedCollection new
×
32
                                                add: commit;
×
33
                                                yourself ] ] ].
×
34

×
35

×
36

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

×
46
                               durationFromA2B := commitB
×
47
                                                          ifNil: [ 0 ]
×
48
                                                          ifNotNil: [
×
49
                                                          commitB created_at - commitA created_at ].
×
50
                               durationFromA2B ] ].
×
51

×
52

×
53

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

×
63
        res := res reject: #isNil.
×
64

×
65
        average := res
×
66
                           ifEmpty: [ nil ]
×
67
                           ifNotEmpty: [ res values average asFloat ].
×
68

×
69
        ^ average
×
70
]
×
71

72
{ #category : #accessing }
UNCOV
73
DelayUntilFirstChurnMetric >> description [
×
74

×
75
        ^ 'delay Until First Churn (W=' , maxCommitWindow printString
×
76
                           , ')'
×
77
]
×
78

79
{ #category : #initialization }
UNCOV
80
DelayUntilFirstChurnMetric >> initialize [
×
81
        super initialize.
×
82
        maxCommitWindow := 3
×
83
]
×
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