diff --git a/.travis.yml b/.travis.yml index 625ef4a..c10f5a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,4 +3,4 @@ language: go go: "1.10.x" install: make install -script: make build && make test.all +script: make build && make test diff --git a/Makefile b/Makefile index 0fafbe7..6faa8aa 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +.PHONY: test + deps.devtools: @go get github.com/golang/dep/cmd/dep @@ -7,6 +9,6 @@ install: deps.devtools build: @go build -test.all: +test: @go test -v ./test/... diff --git a/fixtures/golint/exported.go b/fixtures/golint/exported.go new file mode 100644 index 0000000..fb2880e --- /dev/null +++ b/fixtures/golint/exported.go @@ -0,0 +1,15 @@ +// Package golint comment +package golint + +type ( + // O is a shortcut (alias) for map[string]interface{}, e.g. a JSON object. + O = map[string]interface{} + + // A is shortcut for []O. + A = []O + + // This Person type is simple + Person = map[string]interface{} +) + +type Foo struct{} // MATCH /exported type Foo should have comment or be unexported/ diff --git a/rule/exported.go b/rule/exported.go index bb95599..1bf2e48 100644 --- a/rule/exported.go +++ b/rule/exported.go @@ -146,8 +146,11 @@ func (w *lintExported) lintTypeDoc(t *ast.TypeSpec, doc *ast.CommentGroup) { } s := doc.Text() - articles := [...]string{"A", "An", "The"} + articles := [...]string{"A", "An", "The", "This"} for _, a := range articles { + if t.Name.Name == a { + continue + } if strings.HasPrefix(s, a+" ") { s = s[len(a)+1:] break