From 99f35eb5a8ec4ff5bfbb8d4bf290aa49b59f53c9 Mon Sep 17 00:00:00 2001 From: Abin Simon Date: Thu, 8 Dec 2022 13:56:27 +0530 Subject: [PATCH] Fix staticcheck lint in CI (#1682) ## Description Missed configuring working dir for staticcheck, plus fixes for errors reported. ## Type of change - [ ] :sunflower: Feature - [ ] :bug: Bugfix - [ ] :world_map: Documentation - [ ] :robot: Test - [x] :computer: CI/Deployment - [ ] :hamster: Trivial/Minor ## Issue(s) * # ## Test Plan - [x] :muscle: Manual - [ ] :zap: Unit test - [ ] :green_heart: E2E --- .github/workflows/ci.yml | 3 ++ src/cmd/getM365/getItem.go | 1 + src/pkg/repository/repository_load_test.go | 32 +++++++++++----------- src/staticcheck.conf | 1 + 4 files changed, 21 insertions(+), 16 deletions(-) create mode 100644 src/staticcheck.conf diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea2e3fdd3..c1a022e5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -362,6 +362,9 @@ jobs: - name: Run staticcheck uses: dominikh/staticcheck-action@v1.2.0 + with: + install-go: false + working-directory: src # ---------------------------------------------------------------------------------------------------- diff --git a/src/cmd/getM365/getItem.go b/src/cmd/getM365/getItem.go index 9b2477006..b3ede3f5a 100644 --- a/src/cmd/getM365/getItem.go +++ b/src/cmd/getM365/getItem.go @@ -148,6 +148,7 @@ func runDisplayM365JSON( fmt.Println(string(array)) + //lint:ignore SA4004 only expecting one item return nil } diff --git a/src/pkg/repository/repository_load_test.go b/src/pkg/repository/repository_load_test.go index b4d13312c..2fdc6ad9d 100644 --- a/src/pkg/repository/repository_load_test.go +++ b/src/pkg/repository/repository_load_test.go @@ -25,22 +25,22 @@ import ( "github.com/alcionai/corso/src/pkg/storage" ) -//nolint:unused +//lint:ignore U1000 future test use func orgSiteSet(t *testing.T) []string { return tester.LoadTestM365OrgSites(t) } -//nolint:unused +//lint:ignore U1000 future test use func orgUserSet(t *testing.T) []string { return tester.LoadTestM365OrgUsers(t) } -//nolint:unused +//lint:ignore U1000 future test use func singleSiteSet(t *testing.T) []string { return []string{tester.LoadTestM365SiteID(t)} } -//nolint:unused +//lint:ignore U1000 future test use func singleUserSet(t *testing.T) []string { return []string{tester.LoadTestM365UserID(t)} } @@ -372,8 +372,8 @@ type RepositoryLoadTestExchangeSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account //nolint:unused - st storage.Storage //nolint:unused + acct account.Account //lint:ignore U1000 future test use + st storage.Storage //lint:ignore U1000 future test use usersUnderTest []string } @@ -422,8 +422,8 @@ type RepositoryIndividualLoadTestExchangeSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account //nolint:unused - st storage.Storage //nolint:unused + acct account.Account //lint:ignore U1000 future test use + st storage.Storage //lint:ignore U1000 future test use usersUnderTest []string } @@ -475,8 +475,8 @@ type RepositoryLoadTestOneDriveSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account //nolint:unused - st storage.Storage //nolint:unused + acct account.Account //lint:ignore U1000 future test use + st storage.Storage //lint:ignore U1000 future test use usersUnderTest []string } @@ -522,8 +522,8 @@ type RepositoryIndividualLoadTestOneDriveSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account //nolint:unused - st storage.Storage //nolint:unused + acct account.Account //lint:ignore U1000 future test use + st storage.Storage //lint:ignore U1000 future test use usersUnderTest []string } @@ -573,8 +573,8 @@ type RepositoryLoadTestSharePointSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account //nolint:unused - st storage.Storage //nolint:unused + acct account.Account //lint:ignore U1000 future test use + st storage.Storage //lint:ignore U1000 future test use sitesUnderTest []string } @@ -620,8 +620,8 @@ type RepositoryIndividualLoadTestSharePointSuite struct { suite.Suite ctx context.Context repo repository.Repository - acct account.Account //nolint:unused - st storage.Storage //nolint:unused + acct account.Account //lint:ignore U1000 future test use + st storage.Storage //lint:ignore U1000 future test use sitesUnderTest []string } diff --git a/src/staticcheck.conf b/src/staticcheck.conf new file mode 100644 index 000000000..be8f3982c --- /dev/null +++ b/src/staticcheck.conf @@ -0,0 +1 @@ +dot_import_whitelist = ["github.com/alcionai/corso/src/cli/print"]