mirror of
https://github.com/fzipp/gocyclo.git
synced 2025-02-06 10:23:54 +00:00
use stable sort for stable tests
This commit is contained in:
parent
d664e74d8c
commit
0198fc9b4a
@ -30,9 +30,9 @@ func TestAnalyze(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]string{"testdata/cases.go"},
|
||||
`3 testdata c3default testdata/cases.go:32:1
|
||||
`3 testdata c3nested testdata/cases.go:40:1
|
||||
3 testdata c3default testdata/cases.go:32:1
|
||||
3 testdata c3 testdata/cases.go:25:1
|
||||
3 testdata c3nested testdata/cases.go:40:1
|
||||
2 testdata c2multi testdata/cases.go:19:1
|
||||
2 testdata c2default testdata/cases.go:12:1
|
||||
2 testdata c2 testdata/cases.go:6:1
|
||||
|
2
stats.go
2
stats.go
@ -52,7 +52,7 @@ func (s Stats) TotalComplexity() uint64 {
|
||||
func (s Stats) SortAndFilter(top, over int) Stats {
|
||||
result := make(Stats, len(s))
|
||||
copy(result, s)
|
||||
sort.Sort(byComplexityDesc(result))
|
||||
sort.Stable(byComplexityDesc(result))
|
||||
for i, stat := range result {
|
||||
if i == top {
|
||||
return result[:i]
|
||||
|
Loading…
x
Reference in New Issue
Block a user