From 106c52de5194b794e76e3004e40dc159e0172033 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Fri, 8 Apr 2022 21:59:08 -0400 Subject: [PATCH] *_test.go: ignore cyclomatic complexity for test files Signed-off-by: Vincent Batts --- compare_test.go | 4 ++++ fseval_test.go | 1 + keywords_linux_test.go | 1 + tar_test.go | 2 ++ update_linux_test.go | 1 + update_test.go | 2 ++ 6 files changed, 11 insertions(+) diff --git a/compare_test.go b/compare_test.go index 5a13961..186e42f 100644 --- a/compare_test.go +++ b/compare_test.go @@ -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 { diff --git a/fseval_test.go b/fseval_test.go index d3d6128..9535cb6 100644 --- a/fseval_test.go +++ b/fseval_test.go @@ -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 { diff --git a/keywords_linux_test.go b/keywords_linux_test.go index 394b8ce..dbaac0a 100644 --- a/keywords_linux_test.go +++ b/keywords_linux_test.go @@ -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 { diff --git a/tar_test.go b/tar_test.go index 82d8abe..e4eaa56 100644 --- a/tar_test.go +++ b/tar_test.go @@ -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 { diff --git a/update_linux_test.go b/update_linux_test.go index e721d8f..f51026f 100644 --- a/update_linux_test.go +++ b/update_linux_test.go @@ -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 diff --git a/update_test.go b/update_test.go index 5c305d1..ddce65c 100644 --- a/update_test.go +++ b/update_test.go @@ -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")