mirror of
https://github.com/gojp/goreportcard.git
synced 2026-01-28 22:39:05 +08:00
Create errcheck checker and add handler
This commit is contained in:
27
check/errcheck.go
Normal file
27
check/errcheck.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package check
|
||||
|
||||
// errcheck is the check for the errcheck command
|
||||
type Errcheck struct {
|
||||
Dir string
|
||||
Filenames []string
|
||||
}
|
||||
|
||||
// Name returns the name of the display name of the command
|
||||
func (e Errcheck) Name() string {
|
||||
return "errcheck"
|
||||
}
|
||||
|
||||
// Weight returns the weight this check has in the overall average
|
||||
func (e Errcheck) Weight() float64 {
|
||||
return .10
|
||||
}
|
||||
|
||||
// Percentage returns the percentage of .go files that pass errcheck
|
||||
func (e Errcheck) Percentage() (float64, []FileSummary, error) {
|
||||
return GoTool(e.Dir, e.Filenames, []string{"gometalinter", "--deadline=180s", "--disable-all", "--enable=errcheck", "--min-confidence=0.85"})
|
||||
}
|
||||
|
||||
// Description returns the description of errcheck
|
||||
func (e Errcheck) Description() string {
|
||||
return `errcheck checks that you checked errors.`
|
||||
}
|
||||
@@ -183,6 +183,7 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) {
|
||||
check.GoLint{Dir: dir, Filenames: filenames},
|
||||
check.GoCyclo{Dir: dir, Filenames: filenames},
|
||||
check.License{Dir: dir, Filenames: []string{}},
|
||||
check.Errcheck{Dir: dir, Filenames: filenames},
|
||||
check.Misspell{Dir: dir, Filenames: filenames},
|
||||
check.IneffAssign{Dir: dir, Filenames: filenames},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user