diff options
author | Ævar Arnfjörð Bjarmason <avar@gitlab.com> | 2021-01-18 16:26:35 +0300 |
---|---|---|
committer | Ævar Arnfjörð Bjarmason <avar@gitlab.com> | 2021-01-18 16:26:35 +0300 |
commit | d31f61307ff82da6d881612bb677bbd3e2f61f2f (patch) | |
tree | 01798f8bd9b5f4441d7982adc6ea881441fa2c41 | |
parent | ecf0a2161dc283f48d2d5f11ce57bed970f76772 (diff) | |
parent | 1518a145e8e064a3f720f0ff03a1f368759687db (diff) |
Merge branch 'avar/tone-down-new-lint-in-20ef26439' into 'master'
golangci: whitelist common test patterns
See merge request gitlab-org/gitaly!2962
-rw-r--r-- | .golangci.yml | 8 | ||||
-rw-r--r-- | internal/gitaly/service/operations/tags_test.go | 10 | ||||
-rw-r--r-- | internal/gitaly/service/server/disk_stats_test.go | 2 |
3 files changed, 9 insertions, 11 deletions
diff --git a/.golangci.yml b/.golangci.yml index df943324e..e505c78a5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -46,6 +46,14 @@ issues: linters: - maligned - noctx + - linters: + - errcheck + path: "_test.go" + text: "Error return value of `(cc|con(ns?)?|db|closer|lis(tener)?).Close` is not checked" + - linters: + - golint + path: "_test.go" + text: "context.Context should be the first parameter of a function" # Maximum issues count per one linter. Set to 0 to disable. Default is 50. max-issues-per-linter: 0 # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. diff --git a/internal/gitaly/service/operations/tags_test.go b/internal/gitaly/service/operations/tags_test.go index 5be077e14..04d5560f8 100644 --- a/internal/gitaly/service/operations/tags_test.go +++ b/internal/gitaly/service/operations/tags_test.go @@ -282,13 +282,11 @@ func TestSuccessfulUserCreateTagRequestAnnotatedLightweightDisambiguation(t *tes }).Run(t, testSuccessfulUserCreateTagRequestAnnotatedLightweightDisambiguation) } -//nolint:golint func testSuccessfulUserCreateTagRequestAnnotatedLightweightDisambiguation(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() client, conn := newOperationClient(t, serverSocketPath) - //nolint:errcheck defer conn.Close() testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t) @@ -387,13 +385,11 @@ func TestSuccessfulUserCreateTagRequestWithParsedTargetRevision(t *testing.T) { }).Run(t, testSuccessfulUserCreateTagRequestWithParsedTargetRevision) } -//nolint:golint func testSuccessfulUserCreateTagRequestWithParsedTargetRevision(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() client, conn := newOperationClient(t, serverSocketPath) - //nolint:errcheck defer conn.Close() testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t) @@ -476,7 +472,6 @@ func TestSuccessfulUserCreateTagRequestToNonCommit(t *testing.T) { testWithFeature(t, featureflag.GoUserCreateTag, testSuccessfulUserCreateTagRequestToNonCommit) } -//nolint:golint func testSuccessfulUserCreateTagRequestToNonCommit(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -599,7 +594,6 @@ func TestSuccessfulUserCreateTagNestedTags(t *testing.T) { testWithFeature(t, featureflag.GoUserCreateTag, testSuccessfulUserCreateTagNestedTags) } -//nolint:golint func testSuccessfulUserCreateTagNestedTags(t *testing.T, ctx context.Context) { locator := config.NewLocator(config.Config) @@ -796,7 +790,6 @@ func TestUserCreateTagsuccessfulCreationOfPrefixedTag(t *testing.T) { testWithFeature(t, featureflag.GoUserCreateTag, testUserCreateTagsuccessfulCreationOfPrefixedTag) } -//nolint:golint func testUserCreateTagsuccessfulCreationOfPrefixedTag(t *testing.T, ctx context.Context) { testRepo, testRepoPath, cleanupFn := testhelper.NewTestRepo(t) defer cleanupFn() @@ -1031,7 +1024,6 @@ func TestFailedUserCreateTagDueToHooks(t *testing.T) { testWithFeature(t, featureflag.GoUserCreateTag, testFailedUserCreateTagDueToHooks) } -//nolint:golint func testFailedUserCreateTagDueToHooks(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -1065,7 +1057,6 @@ func TestFailedUserCreateTagRequestDueToTagExistence(t *testing.T) { testWithFeature(t, featureflag.GoUserCreateTag, testFailedUserCreateTagRequestDueToTagExistence) } -//nolint:golint func testFailedUserCreateTagRequestDueToTagExistence(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() @@ -1125,7 +1116,6 @@ func TestFailedUserCreateTagRequestDueToValidation(t *testing.T) { testWithFeature(t, featureflag.GoUserCreateTag, testFailedUserCreateTagRequestDueToValidation) } -//nolint:golint func testFailedUserCreateTagRequestDueToValidation(t *testing.T, ctx context.Context) { serverSocketPath, stop := runOperationServiceServer(t) defer stop() diff --git a/internal/gitaly/service/server/disk_stats_test.go b/internal/gitaly/service/server/disk_stats_test.go index a0e7d5673..1c2157230 100644 --- a/internal/gitaly/service/server/disk_stats_test.go +++ b/internal/gitaly/service/server/disk_stats_test.go @@ -26,7 +26,7 @@ func TestStorageDiskStatistics(t *testing.T) { defer server.Stop() client, conn := newServerClient(t, serverSocketPath) - defer conn.Close() // nolint: errcheck + defer conn.Close() ctx, cancel := testhelper.Context() defer cancel() |