From cdbe3cba31ed6ce0100d90ae42e77e76b290f9ce Mon Sep 17 00:00:00 2001 From: Herman Schaaf Date: Wed, 15 Jun 2016 17:12:22 +0800 Subject: [PATCH] Add errcheck check --- check/errcheck.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 check/errcheck.go diff --git a/check/errcheck.go b/check/errcheck.go new file mode 100644 index 0000000..fb5ef49 --- /dev/null +++ b/check/errcheck.go @@ -0,0 +1,27 @@ +package check + +// ErrCheck is the check for the go fmt command +type ErrCheck struct { + Dir string + Filenames []string +} + +// Name returns the name of the display name of the command +func (c ErrCheck) Name() string { + return "errcheck" +} + +// Weight returns the weight this check has in the overall average +func (c ErrCheck) Weight() float64 { + return .15 +} + +// Percentage returns the percentage of .go files that pass gofmt +func (c ErrCheck) Percentage() (float64, []FileSummary, error) { + return GoTool(c.Dir, c.Filenames, []string{"gometalinter", "--deadline=180s", "--disable-all", "--enable=errcheck"}) +} + +// Description returns the description of gofmt +func (c ErrCheck) Description() string { + return `errcheck finds unchecked errors in go programs` +}