Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeistel <6742251-feistel@users.noreply.gitlab.com>2022-05-02 18:27:44 +0300
committerfeistel <6742251-feistel@users.noreply.gitlab.com>2022-05-02 18:27:44 +0300
commit52e8043921ae31d31e40665902600f97a9f60d9f (patch)
tree6d5e7037635076703b77d78d6c544d02493cf366
parent7c999a3c3411ce6b62cc7fba97f29343c9ef7806 (diff)
Add nolintlint linter configuration
Require an explanation for nolint rules and warn about unused rules
-rw-r--r--.golangci.yml10
-rw-r--r--internal/auth/auth.go3
-rw-r--r--internal/handlers/handlers.go2
-rw-r--r--internal/source/gitlab/client/client.go1
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()