From 70febae13bfce30e013e4e893109e45ee2738e80 Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Wed, 15 Jun 2016 11:19:57 +0200 Subject: [PATCH 1/2] Create errcheck checker and add handler --- check/errcheck.go | 27 +++++++++++++++++++++++++++ handlers/checks.go | 1 + 2 files changed, 28 insertions(+) create mode 100644 check/errcheck.go diff --git a/check/errcheck.go b/check/errcheck.go new file mode 100644 index 0000000..e61a09e --- /dev/null +++ b/check/errcheck.go @@ -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.` +} diff --git a/handlers/checks.go b/handlers/checks.go index df80136..1eb8c72 100644 --- a/handlers/checks.go +++ b/handlers/checks.go @@ -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}, } From 819b7ccd9e1277ddc6bcbc1f2ec415e2b03f4abe Mon Sep 17 00:00:00 2001 From: Matthias Loibl Date: Wed, 15 Jun 2016 12:01:20 +0200 Subject: [PATCH 2/2] Fix typo in errcheck comment --- check/errcheck.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check/errcheck.go b/check/errcheck.go index e61a09e..35c0ee1 100644 --- a/check/errcheck.go +++ b/check/errcheck.go @@ -1,6 +1,6 @@ package check -// errcheck is the check for the errcheck command +// Errcheck is the check for the errcheck command type Errcheck struct { Dir string Filenames []string