forked from threefoldtech/zos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from threefoldtech/development_fix_linter
fix linter
- Loading branch information
Showing
22 changed files
with
58 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
linters: | ||
enable: | ||
- errcheck | ||
- gofmt | ||
- govet | ||
- ineffassign | ||
- unconvert | ||
- staticcheck | ||
- gocyclo | ||
enable-all: false | ||
linters-settings: | ||
gocyclo: | ||
# Minimal code complexity to report. | ||
# Default: 30 (but we recommend 10-20) | ||
min-complexity: 100 | ||
run: | ||
timeout: 20m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,51 +3,21 @@ GOPATH := $(shell go env GOPATH) | |
|
||
all: build | ||
|
||
getdeps: | ||
@echo "Installing golint" && go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
@echo "Installing gocyclo" && go install github.com/fzipp/gocyclo/cmd/gocyclo@latest | ||
@echo "Installing deadcode" && go install github.com/remyoudompheng/go-misc/deadcode@latest | ||
@echo "Installing misspell" && go install github.com/client9/misspell/cmd/misspell@latest | ||
@echo "Installing ineffassign" && go install github.com/gordonklaus/ineffassign@latest | ||
@echo "Installing staticcheck" && go install honnef.co/go/tools/cmd/staticcheck@latest | ||
|
||
verifiers: vet fmt lint cyclo spelling static #deadcode | ||
|
||
vet: | ||
@echo "Running $@" | ||
@go vet -atomic -bool -copylocks -nilfunc -printf -rangeloops -unreachable -unsafeptr -unusedresult ./... | ||
all: getdeps test | ||
|
||
fmt: | ||
@echo "Running $@" | ||
@gofmt -d . | ||
getdeps: | ||
@echo "Installing golangci-lint" && go get github.com/golangci/golangci-lint/cmd/golangci-lint && go install github.com/golangci/golangci-lint/cmd/golangci-lint | ||
go mod tidy | ||
|
||
lint: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/golangci-lint run | ||
|
||
ineffassign: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/ineffassign . | ||
|
||
cyclo: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/gocyclo -over 100 . | ||
|
||
deadcode: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/deadcode -test $(shell go list ./...) || true | ||
|
||
spelling: | ||
@${GOPATH}/bin/misspell -i "monitord,forumla,etherent" -error `find .` | ||
|
||
static: | ||
@${GOPATH}/bin/staticcheck -- ./... | ||
@${GOPATH}/bin/golangci-lint run -c ../.golangci.yml | ||
|
||
check: test | ||
test: verifiers build | ||
test: lint build | ||
go test -vet=off -v $(shell go list ./... | grep -Ev "stubs|network" ) | ||
|
||
testrace: verifiers build | ||
testrace: lint build | ||
go test -vet=off -v $(shell go list ./... | grep -Ev "stubs|network" ) | ||
|
||
generate: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,41 +8,14 @@ ldflags='-w -s -X $(version).Branch=$(branch) -X $(version).Revision=$(revision) | |
all: getdeps test | ||
|
||
getdeps: | ||
@echo "Installing staticcheck" && go get -u honnef.co/go/tools/cmd/staticcheck && go install honnef.co/go/tools/cmd/staticcheck | ||
@echo "Installing gocyclo" && go get -u github.com/fzipp/gocyclo/cmd/gocyclo && go install github.com/fzipp/gocyclo/cmd/gocyclo | ||
@echo "Installing deadcode" && go get -u github.com/remyoudompheng/go-misc/deadcode && go install github.com/remyoudompheng/go-misc/deadcode | ||
@echo "Installing misspell" && go get -u github.com/client9/misspell/cmd/misspell && go install github.com/client9/misspell/cmd/misspell | ||
@echo "Installing golangci-lint" && go install github.com/golangci/golangci-lint/cmd/[email protected] | ||
@echo "Installing golangci-lint" && go get github.com/golangci/golangci-lint/cmd/golangci-lint && go install github.com/golangci/golangci-lint/cmd/golangci-lint | ||
go mod tidy | ||
|
||
|
||
verifiers: fmt lint cyclo deadcode spelling staticcheck | ||
|
||
fmt: | ||
@echo "Running $@" | ||
@gofmt -d . | ||
|
||
lint: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/golangci-lint run | ||
|
||
cyclo: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/gocyclo -over 100 . | ||
|
||
deadcode: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/deadcode -test $(shell go list ./...) || true | ||
|
||
spelling: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/misspell -i monitord -error `find .` | ||
|
||
staticcheck: | ||
@echo "Running $@" | ||
@${GOPATH}/bin/staticcheck -- ./... | ||
golangci-lint run -c ../../.golangci.yml | ||
|
||
test: verifiers | ||
test: lint | ||
go test -v -vet=off ./... | ||
|
||
benchmarks: | ||
|
@@ -53,7 +26,7 @@ coverage: clean | |
go test -v -vet=off ./... -coverprofile=coverage/coverage.out | ||
go tool cover -html=coverage/coverage.out -o coverage/coverage.html | ||
|
||
testrace: verifiers | ||
testrace: lint | ||
go test -v -race -vet=off ./... | ||
|
||
run: | ||
|