diff options
author | Jaime Martinez <jmartinez@gitlab.com> | 2022-05-03 22:17:11 +0300 |
---|---|---|
committer | Jaime Martinez <jmartinez@gitlab.com> | 2022-05-03 22:17:11 +0300 |
commit | 40528a5463f155f70d33dac3573199c0ba3e599d (patch) | |
tree | 6d5e7037635076703b77d78d6c544d02493cf366 | |
parent | 7c999a3c3411ce6b62cc7fba97f29343c9ef7806 (diff) | |
parent | 52e8043921ae31d31e40665902600f97a9f60d9f (diff) |
Merge branch 'feat/nolintlint-required' into 'master'
refactor: add nolintlint linter configuration
See merge request gitlab-org/gitlab-pages!764
-rw-r--r-- | .golangci.yml | 10 | ||||
-rw-r--r-- | internal/auth/auth.go | 3 | ||||
-rw-r--r-- | internal/handlers/handlers.go | 2 | ||||
-rw-r--r-- | internal/source/gitlab/client/client.go | 1 |
4 files changed, 12 insertions, 4 deletions
diff --git a/.golangci.yml b/.golangci.yml index 3b472def..795ee62b 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -37,6 +37,16 @@ linters-settings: min-occurrences: 3 goimports: local-prefixes: gitlab.com/gitlab-org/gitlab-pages + nolintlint: + # Disable to ensure that all nolint directives actually have an effect. + # Default: false + allow-unused: false + # Enable to require an explanation of nonzero length after each nolint directive. + # Default: false + require-explanation: true + # Enable to require nolint directives to mention the specific linter being suppressed. + # Default: false + require-specific: true staticcheck: # Select the Go version to target. # Default: 1.13 diff --git a/internal/auth/auth.go b/internal/auth/auth.go index 05542d21..59dd0749 100644 --- a/internal/auth/auth.go +++ b/internal/auth/auth.go @@ -28,9 +28,8 @@ import ( "gitlab.com/gitlab-org/gitlab-pages/internal/source" ) -// nolint: gosec +// nolint: gosec // auth constants, not credentials // gosec: G101: Potential hardcoded credentials -// auth constants, not credentials const ( apiURLUserTemplate = "%s/api/v4/user" apiURLProjectTemplate = "%s/api/v4/projects/%d/pages_access" diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index 76724387..22d49e4b 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -62,7 +62,7 @@ func (a *Handlers) HandleArtifactRequest(host string, w http.ResponseWriter, r * return true } - // nolint: bodyclose + // nolint: bodyclose // false positive // a.checkIfLoginRequiredOrInvalidToken returns a response.Body, closing this body is responsibility // of the TryMakeRequest implementation return a.Artifact.TryMakeRequest(host, w, r, token, a.checkIfLoginRequiredOrInvalidToken(w, r, token)) diff --git a/internal/source/gitlab/client/client.go b/internal/source/gitlab/client/client.go index 60a8c650..5dc090dd 100644 --- a/internal/source/gitlab/client/client.go +++ b/internal/source/gitlab/client/client.go @@ -150,7 +150,6 @@ func (gc *Client) get(ctx context.Context, path string, params url.Values) (*htt return resp, nil } - // nolint: errcheck // best effort to discard and close the response body io.Copy(io.Discard, resp.Body) resp.Body.Close() |