Create errcheck checker and add handler

This commit is contained in:
Matthias Loibl
2016-06-15 11:19:57 +02:00
parent a1f8fb1266
commit 70febae13b
2 changed files with 28 additions and 0 deletions

27
check/errcheck.go Normal file
View 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.`
}

View File

@@ -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},
}