Skip to content

Commit

Permalink
replace gometalinter with golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
MarioCarrion committed Mar 24, 2019
1 parent 3e11ae2 commit 430ebde
Show file tree
Hide file tree
Showing 15 changed files with 39 additions and 43 deletions.
14 changes: 12 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@ jobs:
- checkout
- run: go build github.com/MarioCarrion/nit/testdata
- run: go build github.com/MarioCarrion/nit/cmd/nit
lint:
golint:
docker:
- image: golangci/golangci-lint:v1.15
working_directory: /go/src/github.com/MarioCarrion/nit
environment:
CGO_ENABLED: 0
steps:
- checkout
- run: golangci-lint run ./...
nitlint:
docker:
- image: mariocarrion/nit:v0.1.1
working_directory: /go/src/github.com/MarioCarrion/nit
Expand All @@ -41,7 +50,8 @@ workflows:
jobs:
- test
- build
- lint
- golint
- nitlint
release:
jobs:
- release:
Expand Down
1 change: 1 addition & 0 deletions .go-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.11.4
9 changes: 9 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
linters:
enable-all: true

issues:
exclude-rules:
- path: _test\.go
linters:
- scopelint
- gocritic
11 changes: 0 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,3 @@ WORKDIR /
COPY ./ ./go/src/github.com/MarioCarrion/nit

RUN CGO_ENABLED=0 GOOS=linux go build --ldflags="-s" -a -installsuffix cgo -o /go/bin/nit ./go/src/github.com/MarioCarrion/nit/cmd/nit

#--

FROM supinf/gometalinter:2.0.11

COPY --from=0 /go/bin/* /go/bin/

WORKDIR /go/src

ENTRYPOINT ["gometalinter"]
CMD ["--help"]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@ A really, really nitpicking linter that complains when the code is not organized

### Development

Requires [`dep`](https://github.com/golang/dep), you can use [retool](https://github.com/twitchtv/retool) for installing that dependency.
* Requires [`dep`](https://github.com/golang/dep), you can use [retool](https://github.com/twitchtv/retool) for installing that dependency.
* [goenv](https://github.com/syndbg/goenv) is used for versioning Go.
5 changes: 1 addition & 4 deletions break_comments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ func TestBreakComments(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
f, fset, err := newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
f, fset := newParserFile(ts, tt.filename)

var actual []int

Expand Down
5 changes: 1 addition & 4 deletions consts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ func TestConstsValidator_Validate(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
f, fset, err := newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
f, fset := newParserFile(ts, tt.filename)

for _, s := range f.Decls {
switch g := s.(type) {
Expand Down
2 changes: 1 addition & 1 deletion funcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestFuncsValidator_Validate(t *testing.T) {
fset *token.FileSet
)

f, fset, err = newParserFile(ts, tt.filename)
f, fset = newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion imports.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func (externalImportsTransition) Local() (ImportsTransition, error) {
}

func (externalImportsTransition) Standard() (ImportsTransition, error) {
return nil, errors.New("standard imports is invalid, next one must be external or local.")
return nil, errors.New("standard imports is invalid, next one must be external or local")
}

//-
Expand Down
5 changes: 1 addition & 4 deletions imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ func TestImportsValidator(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
f, fset, err := newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
f, fset := newParserFile(ts, tt.filename)

for _, s := range f.Decls {
switch g := s.(type) {
Expand Down
5 changes: 1 addition & 4 deletions methods_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ func TestMethodsValidator_Validate(t *testing.T) {
validator *nit.MethodsValidator
)

f, fset, err = newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
f, fset = newParserFile(ts, tt.filename)

comments := nit.NewBreakComments(fset, f.Comments)

Expand Down
4 changes: 2 additions & 2 deletions nit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"
)

func newParserFile(t *testing.T, name string) (*ast.File, *token.FileSet, error) {
func newParserFile(t *testing.T, name string) (*ast.File, *token.FileSet) {
t.Helper()

fset := token.NewFileSet()
Expand All @@ -17,5 +17,5 @@ func newParserFile(t *testing.T, name string) (*ast.File, *token.FileSet, error)
t.Fatalf("expected no error, got %s", err)
}

return f, fset, nil
return f, fset
}
6 changes: 5 additions & 1 deletion tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
{
"Repository": "github.com/golang/dep/cmd/dep",
"Commit": "224a564abe296670b692fe08bb63a3e4c4ad7978"
},
{
"Repository": "github.com/golangci/golangci-lint/cmd/golangci-lint",
"Commit": "901cf25e20f86b7e9dc6f73eaba5afbd0cbdc257"
}
],
"RetoolVersion": "1.3.5"
"RetoolVersion": "1.3.7"
}
5 changes: 1 addition & 4 deletions types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ func TestTypesValidator_Validate(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
f, fset, err := newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
f, fset := newParserFile(ts, tt.filename)

for _, s := range f.Decls {
switch g := s.(type) {
Expand Down
5 changes: 1 addition & 4 deletions vars_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,7 @@ func TestVarsValidator_Validate(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(ts *testing.T) {
f, fset, err := newParserFile(ts, tt.filename)
if err != nil {
ts.Fatalf("expected no error, got %s", err)
}
f, fset := newParserFile(ts, tt.filename)

for _, s := range f.Decls {
switch g := s.(type) {
Expand Down

0 comments on commit 430ebde

Please sign in to comment.