enable cyclomatic check in TravisCI

This commit is contained in:
Dmitry Rozhkov 2018-06-18 11:10:13 +03:00
parent 4a1b311e62
commit 8c1d84863c
2 changed files with 7 additions and 1 deletions

View File

@ -5,6 +5,7 @@ go:
before_install:
- go get -v github.com/golang/lint/golint
- go get -v github.com/fzipp/gocyclo
# hack for building on forks
- repo=`basename $PWD`; src=`dirname $PWD`; dest="`dirname $src`/intel"
- if [[ "$src" != "$dest" ]]; then mv "$src" "$dest"; cd ../../intel/$repo; export TRAVIS_BUILD_DIR=`dirname $TRAVIS_BUILD_DIR`/$repo; fi
@ -13,6 +14,7 @@ script:
- make lint
- make
- make vet
- make cyclomatic-check
- make test
after_success:

View File

@ -1,4 +1,5 @@
GO := go
GOCYCLO := gocyclo
pkgs = $(shell $(GO) list ./... | grep -v vendor)
cmds = $(shell ls cmd)
@ -16,6 +17,9 @@ format:
vet:
@$(GO) vet -v -shadow $(pkgs)
cyclomatic-check:
@report=`$(GOCYCLO) -over 15 cmd internal`; if [ -n "$$report" ]; then echo "Complexity is over 15 in"; echo $$report; exit 1; fi
test:
ifndef WHAT
@$(GO) test -race -coverprofile=coverage.txt -covermode=atomic $(pkgs)
@ -43,4 +47,4 @@ $(images):
images: $(images)
.PHONY: all format vet test lint build images $(cmds) $(images)
.PHONY: all format vet cyclomatic-check test lint build images $(cmds) $(images)