From 02c4c874a8773c5e003a86f5c655373caaeed95e Mon Sep 17 00:00:00 2001 From: Shawn Smith Date: Mon, 11 Jan 2016 16:14:01 +0900 Subject: [PATCH] #52 add misspell --- check/misspell.go | 31 +++++++++++++++++++++++++++++++ handlers/checks.go | 1 + 2 files changed, 32 insertions(+) create mode 100644 check/misspell.go diff --git a/check/misspell.go b/check/misspell.go new file mode 100644 index 0000000..973276b --- /dev/null +++ b/check/misspell.go @@ -0,0 +1,31 @@ +package check + +import "fmt" + +// Misspell is the check for the misspell command +type Misspell struct { + Dir string + Filenames []string +} + +// Name returns the name of the display name of the command +func (g Misspell) Name() string { + return "misspell" +} + +// Weight returns the weight this check has in the overall average +func (g Misspell) Weight() float64 { + return 0.0 +} + +// Percentage returns the percentage of .go files that pass gofmt +func (g Misspell) Percentage() (float64, []FileSummary, error) { + params := AddSkipDirs([]string{"gometalinter", "--deadline=180s", "--disable-all", "--linter", "misspell:misspell ./*.go:PATH:LINE:MESSAGE", "--enable=misspell"}) + fmt.Println(params) + return GoTool(g.Dir, g.Filenames, params) +} + +// Description returns the description of Misspell +func (g Misspell) Description() string { + return `Misspell Finds commonly misspelled English words` +} diff --git a/handlers/checks.go b/handlers/checks.go index 524e500..bf19dc9 100644 --- a/handlers/checks.go +++ b/handlers/checks.go @@ -139,6 +139,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.Misspell{Dir: dir, Filenames: filenames}, } ch := make(chan score)