From 41260decd3d357d3ce14d1046c8f8e479028ab68 Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Sat, 19 Mar 2016 00:36:06 +0900 Subject: [PATCH] #104 add ineffassign check --- check/ineffassign.go | 27 +++++++++++++++++++++++++++ handlers/checks.go | 1 + 2 files changed, 28 insertions(+) create mode 100644 check/ineffassign.go diff --git a/check/ineffassign.go b/check/ineffassign.go new file mode 100644 index 0000000..945c093 --- /dev/null +++ b/check/ineffassign.go @@ -0,0 +1,27 @@ +package check + +// IneffAssign is the check for the ineffassign command +type IneffAssign struct { + Dir string + Filenames []string +} + +// Name returns the name of the display name of the command +func (g IneffAssign) Name() string { + return "ineffassign" +} + +// Weight returns the weight this check has in the overall average +func (g IneffAssign) Weight() float64 { + return 0.0 +} + +// Percentage returns the percentage of .go files that pass gofmt +func (g IneffAssign) Percentage() (float64, []FileSummary, error) { + return GoTool(g.Dir, g.Filenames, []string{"gometalinter", "--deadline=180s", "--disable-all", "--enable=ineffassign"}) +} + +// Description returns the description of IneffAssign +func (g IneffAssign) Description() string { + return `IneffAssign detects ineffectual assignments in Go code.` +} diff --git a/handlers/checks.go b/handlers/checks.go index d869c26..44e2210 100644 --- a/handlers/checks.go +++ b/handlers/checks.go @@ -156,6 +156,7 @@ func newChecksResp(repo string, forceRefresh bool) (checksResp, error) { check.GoCyclo{Dir: dir, Filenames: filenames}, check.License{Dir: dir, Filenames: []string{}}, check.Misspell{Dir: dir, Filenames: filenames}, + check.IneffAssign{Dir: dir, Filenames: filenames}, } ch := make(chan score)