mirror of
https://github.com/intel/intel-device-plugins-for-kubernetes.git
synced 2025-06-03 03:59:37 +00:00
enable cyclomatic check in TravisCI
This commit is contained in:
parent
4a1b311e62
commit
8c1d84863c
@ -5,6 +5,7 @@ go:
|
|||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- go get -v github.com/golang/lint/golint
|
- go get -v github.com/golang/lint/golint
|
||||||
|
- go get -v github.com/fzipp/gocyclo
|
||||||
# hack for building on forks
|
# hack for building on forks
|
||||||
- repo=`basename $PWD`; src=`dirname $PWD`; dest="`dirname $src`/intel"
|
- 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
|
- 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 lint
|
||||||
- make
|
- make
|
||||||
- make vet
|
- make vet
|
||||||
|
- make cyclomatic-check
|
||||||
- make test
|
- make test
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
|
6
Makefile
6
Makefile
@ -1,4 +1,5 @@
|
|||||||
GO := go
|
GO := go
|
||||||
|
GOCYCLO := gocyclo
|
||||||
|
|
||||||
pkgs = $(shell $(GO) list ./... | grep -v vendor)
|
pkgs = $(shell $(GO) list ./... | grep -v vendor)
|
||||||
cmds = $(shell ls cmd)
|
cmds = $(shell ls cmd)
|
||||||
@ -16,6 +17,9 @@ format:
|
|||||||
vet:
|
vet:
|
||||||
@$(GO) vet -v -shadow $(pkgs)
|
@$(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:
|
test:
|
||||||
ifndef WHAT
|
ifndef WHAT
|
||||||
@$(GO) test -race -coverprofile=coverage.txt -covermode=atomic $(pkgs)
|
@$(GO) test -race -coverprofile=coverage.txt -covermode=atomic $(pkgs)
|
||||||
@ -43,4 +47,4 @@ $(images):
|
|||||||
|
|
||||||
images: $(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)
|
||||||
|
Loading…
Reference in New Issue
Block a user