mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-29 06:49:05 +08:00
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -195,9 +196,17 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
|
||||
}
|
||||
}
|
||||
|
||||
sort.Sort(ByName(resp.Checks))
|
||||
resp.Average = total
|
||||
resp.Issues = len(issues)
|
||||
resp.Grade = grade(total * 100)
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// ByName implements sorting for checks alphabetically by name
|
||||
type ByName []score
|
||||
|
||||
func (a ByName) Len() int { return len(a) }
|
||||
func (a ByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a ByName) Less(i, j int) bool { return a[i].Name < a[j].Name }
|
||||
|
||||
Reference in New Issue
Block a user