Skip to content

Commit 3b04d23

Browse files
authored
Merge pull request #281 from vmarkovtsev/master
Add getters of private fields to burndown and devs results
2 parents 91ca4fe + cf3f18f commit 3b04d23

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

leaves/burndown.go

+11
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,17 @@ func (analyser *BurndownAnalysis) groupSparseHistory(
15411541
return result, lastTick
15421542
}
15431543

1544+
// GetTickSize returns the tick size used to generate this burndown analysis result.
1545+
func (br BurndownResult) GetTickSize() time.Duration {
1546+
return br.tickSize
1547+
}
1548+
1549+
// GetIdentities returns the list of developer identities used to generate this burndown analysis result.
1550+
// The format is |-joined keys, see internals/plumbing/identity for details.
1551+
func (br BurndownResult) GetIdentities() []string {
1552+
return br.reversedPeopleDict
1553+
}
1554+
15441555
func init() {
15451556
core.Registry.Register(&BurndownAnalysis{})
15461557
}

leaves/burndown_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -1620,3 +1620,9 @@ func TestBurndownHandleRenameCycle(t *testing.T) {
16201620
"three": {},
16211621
})
16221622
}
1623+
1624+
func TestBurndownResultGetters(t *testing.T) {
1625+
br := BurndownResult{tickSize: time.Hour, reversedPeopleDict: []string{"one", "two"}}
1626+
assert.Equal(t, br.tickSize, br.GetTickSize())
1627+
assert.Equal(t, br.GetIdentities(), br.reversedPeopleDict)
1628+
}

leaves/devs.go

+11
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,17 @@ func (devs *DevsAnalysis) serializeBinary(result *DevsResult, writer io.Writer)
429429
return err
430430
}
431431

432+
// GetTickSize returns the tick size used to generate this devs analysis result.
433+
func (dr DevsResult) GetTickSize() time.Duration {
434+
return dr.tickSize
435+
}
436+
437+
// GetIdentities returns the list of developer identities used to generate this devs analysis result.
438+
// The format is |-joined keys, see internals/plumbing/identity for details.
439+
func (dr DevsResult) GetIdentities() []string {
440+
return dr.reversedPeopleDict
441+
}
442+
432443
func init() {
433444
core.Registry.Register(&DevsAnalysis{})
434445
}

leaves/devs_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,9 @@ func TestDevsMergeResults(t *testing.T) {
448448
identity.AuthorMissing: {100, ls(200, 300, 400), map[string]items.LineStats{"Go": ls(62, 63, 64)}},
449449
})
450450
}
451+
452+
func TestDevsResultGetters(t *testing.T) {
453+
dr := DevsResult{tickSize: time.Hour, reversedPeopleDict: []string{"one", "two"}}
454+
assert.Equal(t, dr.tickSize, dr.GetTickSize())
455+
assert.Equal(t, dr.GetIdentities(), dr.reversedPeopleDict)
456+
}

0 commit comments

Comments
 (0)