1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-12-22 13:56:30 +00:00

Merge pull request #176 from vbatts/cyclo

Cyclomatic complexity
This commit is contained in:
Vincent Batts 2022-04-08 22:39:27 -04:00 committed by GitHub
commit 4760b77e54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 1 deletions

View file

@ -16,6 +16,14 @@ validation: .test .lint .vet .cli.test
.PHONY: validation.tags
validation.tags: .test.tags .vet.tags .cli.test
.PHONY: gocyclo
gocyclo: .gocyclo
CLEAN_FILES += .gocyclo
.gocyclo:
gocyclo -avg -over 15 -ignore 'vendor/*' . && touch $@
.PHONY: test
test: .test
@ -69,7 +77,8 @@ $(BUILD): $(SOURCE_FILES)
go build -mod=vendor -o $(BUILD) $(BUILDPATH)
install.tools:
@go get -u github.com/fatih/color ; \
@go install -u github.com/fatih/color@latest ; \
go install -u github.com/fzipp/gocyclo/cmd/gocyclo@latest ; \
if [ "$(findstring $(GO_VER),$(shell go version))" != "" ] ; then \
go get -u golang.org/x/lint/golint ;\
fi

View file

@ -35,6 +35,7 @@ func TestCompare(t *testing.T) {
}
}
//gocyclo:ignore
func TestCompareModified(t *testing.T) {
dir, err := ioutil.TempDir("", "test-compare-modified")
if err != nil {
@ -114,6 +115,7 @@ func TestCompareModified(t *testing.T) {
}
}
//gocyclo:ignore
func TestCompareMissing(t *testing.T) {
dir, err := ioutil.TempDir("", "test-compare-missing")
if err != nil {
@ -205,6 +207,7 @@ func TestCompareMissing(t *testing.T) {
}
}
//gocyclo:ignore
func TestCompareExtra(t *testing.T) {
dir, err := ioutil.TempDir("", "test-compare-extra")
if err != nil {
@ -338,6 +341,7 @@ func TestCompareKeys(t *testing.T) {
}
}
//gocyclo:ignore
func TestTarCompare(t *testing.T) {
dir, err := ioutil.TempDir("", "test-compare-tar")
if err != nil {

View file

@ -71,6 +71,7 @@ func (fs *MockFsEval) KeywordFunc(fn KeywordFunc) KeywordFunc {
return fn
}
//gocyclo:ignore
func TestCheckFsEval(t *testing.T) {
dir, err := ioutil.TempDir("", "test-check-fs-eval")
if err != nil {

View file

@ -13,6 +13,7 @@ import (
"github.com/vbatts/go-mtree/xattr"
)
//gocyclo:ignore
func TestXattr(t *testing.T) {
testDir, present := os.LookupEnv("MTREE_TESTDIR")
if present == false {

View file

@ -129,6 +129,7 @@ func TestTar(t *testing.T) {
// `tar -cvf some.tar dir1 dir2 dir3 dir4/dir5 dir6` ... etc.
// The testdata of collection.tar resemble such an archive. the `collection` folder
// is the contents of `collection.tar` extracted
//gocyclo:ignore
func TestArchiveCreation(t *testing.T) {
fh, err := os.Open("./testdata/collection.tar")
if err != nil {
@ -197,6 +198,7 @@ func TestArchiveCreation(t *testing.T) {
// evaluated. Also, The fact that this archive contains a single entry, yet the
// entry is associated with a file that has parent directories, means that the
// "." directory should be the lowest sub-directory under which `file` is contained.
//gocyclo:ignore
func TestTreeTraversal(t *testing.T) {
fh, err := os.Open("./testdata/traversal.tar")
if err != nil {

View file

@ -15,6 +15,7 @@ func init() {
//logrus.SetLevel(logrus.DebugLevel)
}
//gocyclo:ignore
func TestXattrUpdate(t *testing.T) {
content := []byte("I know half of you half as well as I ought to")
// a bit dirty to create/destroy a directory in cwd, but often /tmp is

View file

@ -1,3 +1,4 @@
//go:build go1.7
// +build go1.7
package mtree
@ -20,6 +21,7 @@ func init() {
logrus.SetLevel(logrus.DebugLevel)
}
//gocyclo:ignore
func TestUpdate(t *testing.T) {
content := []byte("I know half of you half as well as I ought to")
dir, err := ioutil.TempDir("", "test-check-keywords")