As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Unverified Commit 5c2e8815 authored by Ash McKenzie's avatar Ash McKenzie
Browse files

Fix do not use require in http handlers

parent 6b65a4ca
No related branches found
No related tags found
No related merge requests found
Loading
@@ -13,6 +13,7 @@ import (
Loading
@@ -13,6 +13,7 @@ import (
"time" "time"
"github.com/golang-jwt/jwt/v5" "github.com/golang-jwt/jwt/v5"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
Loading
@@ -240,7 +241,7 @@ func buildRequests(t *testing.T, relativeURLRoot string) []testserver.TestReques
Loading
@@ -240,7 +241,7 @@ func buildRequests(t *testing.T, relativeURLRoot string) []testserver.TestReques
{ {
Path: "/api/v4/internal/hello", Path: "/api/v4/internal/hello",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodGet, r.Method) assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, "Hello") fmt.Fprint(w, "Hello")
}, },
Loading
@@ -248,12 +249,12 @@ func buildRequests(t *testing.T, relativeURLRoot string) []testserver.TestReques
Loading
@@ -248,12 +249,12 @@ func buildRequests(t *testing.T, relativeURLRoot string) []testserver.TestReques
{ {
Path: "/api/v4/internal/post_endpoint", Path: "/api/v4/internal/post_endpoint",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
b, err := io.ReadAll(r.Body) b, err := io.ReadAll(r.Body)
defer r.Body.Close() defer r.Body.Close()
require.NoError(t, err) assert.NoError(t, err)
fmt.Fprint(w, "Echo: "+string(b)) fmt.Fprint(w, "Echo: "+string(b))
}, },
Loading
Loading
Loading
@@ -10,6 +10,7 @@ import (
Loading
@@ -10,6 +10,7 @@ import (
"testing" "testing"
"time" "time"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
) )
Loading
@@ -34,7 +35,7 @@ func TestBasicAuthSettings(t *testing.T) {
Loading
@@ -34,7 +35,7 @@ func TestBasicAuthSettings(t *testing.T) {
{ {
Path: "/api/v4/internal/get_endpoint", Path: "/api/v4/internal/get_endpoint",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodGet, r.Method) assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, r.Header.Get("Authorization")) fmt.Fprint(w, r.Header.Get("Authorization"))
}, },
Loading
@@ -42,7 +43,7 @@ func TestBasicAuthSettings(t *testing.T) {
Loading
@@ -42,7 +43,7 @@ func TestBasicAuthSettings(t *testing.T) {
{ {
Path: "/api/v4/internal/post_endpoint", Path: "/api/v4/internal/post_endpoint",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
fmt.Fprint(w, r.Header.Get("Authorization")) fmt.Fprint(w, r.Header.Get("Authorization"))
}, },
Loading
@@ -82,7 +83,7 @@ func TestEmptyBasicAuthSettings(t *testing.T) {
Loading
@@ -82,7 +83,7 @@ func TestEmptyBasicAuthSettings(t *testing.T) {
{ {
Path: "/api/v4/internal/empty_basic_auth", Path: "/api/v4/internal/empty_basic_auth",
Handler: func(_ http.ResponseWriter, r *http.Request) { Handler: func(_ http.ResponseWriter, r *http.Request) {
require.Equal(t, "", r.Header.Get("Authorization")) assert.Equal(t, "", r.Header.Get("Authorization"))
}, },
}, },
} }
Loading
@@ -100,13 +101,13 @@ func TestRequestWithUserAgent(t *testing.T) {
Loading
@@ -100,13 +101,13 @@ func TestRequestWithUserAgent(t *testing.T) {
{ {
Path: "/api/v4/internal/default_user_agent", Path: "/api/v4/internal/default_user_agent",
Handler: func(_ http.ResponseWriter, r *http.Request) { Handler: func(_ http.ResponseWriter, r *http.Request) {
require.Equal(t, defaultUserAgent, r.UserAgent()) assert.Equal(t, defaultUserAgent, r.UserAgent())
}, },
}, },
{ {
Path: "/api/v4/internal/override_user_agent", Path: "/api/v4/internal/override_user_agent",
Handler: func(_ http.ResponseWriter, r *http.Request) { Handler: func(_ http.ResponseWriter, r *http.Request) {
require.Equal(t, gitalyUserAgent, r.UserAgent()) assert.Equal(t, gitalyUserAgent, r.UserAgent())
}, },
}, },
} }
Loading
Loading
Loading
@@ -8,6 +8,7 @@ import (
Loading
@@ -8,6 +8,7 @@ import (
"path" "path"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/testhelper" "gitlab.com/gitlab-org/gitlab-shell/v14/internal/testhelper"
Loading
@@ -116,7 +117,7 @@ func setupWithRequests(t *testing.T, caFile, caPath, clientCAPath, clientCertPat
Loading
@@ -116,7 +117,7 @@ func setupWithRequests(t *testing.T, caFile, caPath, clientCAPath, clientCertPat
{ {
Path: "/api/v4/internal/hello", Path: "/api/v4/internal/hello",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodGet, r.Method) assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, "Hello") fmt.Fprint(w, "Hello")
}, },
Loading
Loading
Loading
@@ -21,6 +21,7 @@ import (
Loading
@@ -21,6 +21,7 @@ import (
"github.com/mikesmitty/edkey" "github.com/mikesmitty/edkey"
"github.com/pires/go-proxyproto" "github.com/pires/go-proxyproto"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
gitalyClient "gitlab.com/gitlab-org/gitaly/v16/client" gitalyClient "gitlab.com/gitlab-org/gitaly/v16/client"
pb "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" pb "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"
Loading
@@ -112,7 +113,7 @@ func startGitOverHTTPServer(t *testing.T) string {
Loading
@@ -112,7 +113,7 @@ func startGitOverHTTPServer(t *testing.T) string {
switch r.URL.Query().Get("service") { switch r.URL.Query().Get("service") {
case "git-receive-pack": case "git-receive-pack":
stream, err := client.InfoRefsReceivePack(ctx, rpcRequest) stream, err := client.InfoRefsReceivePack(ctx, rpcRequest)
require.NoError(t, err) assert.NoError(t, err)
reader = streamio.NewReader(func() ([]byte, error) { reader = streamio.NewReader(func() ([]byte, error) {
resp, err := stream.Recv() resp, err := stream.Recv()
return resp.GetData(), err return resp.GetData(), err
Loading
@@ -122,17 +123,17 @@ func startGitOverHTTPServer(t *testing.T) string {
Loading
@@ -122,17 +123,17 @@ func startGitOverHTTPServer(t *testing.T) string {
} }
_, err := io.Copy(w, reader) _, err := io.Copy(w, reader)
require.NoError(t, err) assert.NoError(t, err)
}, },
}, },
{ {
Path: "/git-receive-pack", Path: "/git-receive-pack",
Handler: func(_ http.ResponseWriter, r *http.Request) { Handler: func(_ http.ResponseWriter, r *http.Request) {
body, err := io.ReadAll(r.Body) body, err := io.ReadAll(r.Body)
require.NoError(t, err) assert.NoError(t, err)
defer r.Body.Close() defer r.Body.Close()
require.Equal(t, "0000", string(body)) assert.Equal(t, "0000", string(body))
}, },
}, },
} }
Loading
@@ -185,7 +186,7 @@ func successAPI(t *testing.T, handlers ...customHandler) http.Handler {
Loading
@@ -185,7 +186,7 @@ func successAPI(t *testing.T, handlers ...customHandler) http.Handler {
response := buildAllowedResponse(t, "responses/allowed_without_console_messages.json") response := buildAllowedResponse(t, "responses/allowed_without_console_messages.json")
_, err := fmt.Fprint(w, response) _, err := fmt.Fprint(w, response)
require.NoError(t, err) assert.NoError(t, err)
case "/api/v4/internal/shellhorse/git_audit_event": case "/api/v4/internal/shellhorse/git_audit_event":
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
return return
Loading
@@ -495,7 +496,7 @@ func TestGeoGitReceivePackSuccess(t *testing.T) {
Loading
@@ -495,7 +496,7 @@ func TestGeoGitReceivePackSuccess(t *testing.T) {
w.WriteHeader(300) w.WriteHeader(300)
_, err := fmt.Fprint(w, response) _, err := fmt.Fprint(w, response)
require.NoError(t, err) assert.NoError(t, err)
}, },
} }
client := runSSHD(t, successAPI(t, handler)) client := runSSHD(t, successAPI(t, handler))
Loading
Loading
Loading
@@ -8,6 +8,7 @@ import (
Loading
@@ -8,6 +8,7 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
Loading
@@ -73,11 +74,11 @@ func TestLfsAuthenticateRequests(t *testing.T) {
Loading
@@ -73,11 +74,11 @@ func TestLfsAuthenticateRequests(t *testing.T) {
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body) b, err := io.ReadAll(r.Body)
defer r.Body.Close() defer r.Body.Close()
require.NoError(t, err) assert.NoError(t, err)
var request *lfsauthenticate.Request var request *lfsauthenticate.Request
require.NoError(t, json.Unmarshal(b, &request)) assert.NoError(t, json.Unmarshal(b, &request))
require.Equal(t, request.Operation, operation) assert.Equal(t, request.Operation, operation)
if request.UserID == userID { if request.UserID == userID {
body := map[string]interface{}{ body := map[string]interface{}{
Loading
@@ -86,7 +87,7 @@ func TestLfsAuthenticateRequests(t *testing.T) {
Loading
@@ -86,7 +87,7 @@ func TestLfsAuthenticateRequests(t *testing.T) {
"repository_http_path": "https://gitlab.com/repo/path", "repository_http_path": "https://gitlab.com/repo/path",
"expires_in": 1800, "expires_in": 1800,
} }
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
} else { } else {
w.WriteHeader(http.StatusForbidden) w.WriteHeader(http.StatusForbidden)
} }
Loading
@@ -97,10 +98,10 @@ func TestLfsAuthenticateRequests(t *testing.T) {
Loading
@@ -97,10 +98,10 @@ func TestLfsAuthenticateRequests(t *testing.T) {
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body) b, err := io.ReadAll(r.Body)
defer r.Body.Close() defer r.Body.Close()
require.NoError(t, err) assert.NoError(t, err)
var request *accessverifier.Request var request *accessverifier.Request
require.NoError(t, json.Unmarshal(b, &request)) assert.NoError(t, json.Unmarshal(b, &request))
var glID string var glID string
if request.Username == "somename" { if request.Username == "somename" {
Loading
@@ -119,7 +120,7 @@ func TestLfsAuthenticateRequests(t *testing.T) {
Loading
@@ -119,7 +120,7 @@ func TestLfsAuthenticateRequests(t *testing.T) {
}, },
}, },
} }
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
} }
Loading
Loading
Loading
@@ -17,6 +17,7 @@ import (
Loading
@@ -17,6 +17,7 @@ import (
"time" "time"
"github.com/git-lfs/pktline" "github.com/git-lfs/pktline"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/commandargs" "gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/commandargs"
Loading
@@ -46,7 +47,7 @@ func setupWaitGroupForExecute(t *testing.T, cmd *Command) *sync.WaitGroup {
Loading
@@ -46,7 +47,7 @@ func setupWaitGroupForExecute(t *testing.T, cmd *Command) *sync.WaitGroup {
go func() { go func() {
_, err := cmd.Execute(context.Background()) _, err := cmd.Execute(context.Background())
require.NoError(t, err) assert.NoError(t, err)
wg.Done() wg.Done()
}() }()
Loading
@@ -1159,7 +1160,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1159,7 +1160,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
default: default:
body = disallowed body = disallowed
} }
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
{ {
Loading
@@ -1167,10 +1168,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1167,10 +1168,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body) b, err := io.ReadAll(r.Body)
defer r.Body.Close() defer r.Body.Close()
require.NoError(t, err) assert.NoError(t, err)
var request *lfsauthenticate.Request var request *lfsauthenticate.Request
require.NoError(t, json.Unmarshal(b, &request)) assert.NoError(t, json.Unmarshal(b, &request))
if request.KeyID == "rw" { if request.KeyID == "rw" {
body := map[string]interface{}{ body := map[string]interface{}{
"username": "john", "username": "john",
Loading
@@ -1178,7 +1179,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1178,7 +1179,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
"repository_http_path": fmt.Sprintf("%s/group/repo", url), "repository_http_path": fmt.Sprintf("%s/group/repo", url),
"expires_in": 1800, "expires_in": 1800,
} }
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
} else { } else {
w.WriteHeader(http.StatusForbidden) w.WriteHeader(http.StatusForbidden)
} }
Loading
@@ -1187,7 +1188,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1187,7 +1188,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
{ {
Path: "/group/repo/info/lfs/objects/batch", Path: "/group/repo/info/lfs/objects/batch",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte("john:sometoken"))), r.Header.Get("Authorization")) assert.Equal(t, fmt.Sprintf("Basic %s", base64.StdEncoding.EncodeToString([]byte("john:sometoken"))), r.Header.Get("Authorization"))
var requestBody map[string]interface{} var requestBody map[string]interface{}
json.NewDecoder(r.Body).Decode(&requestBody) json.NewDecoder(r.Body).Decode(&requestBody)
Loading
@@ -1214,7 +1215,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1214,7 +1215,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
} }
} }
case evenLargerFileOid: case evenLargerFileOid:
require.Equal(t, evenLargerFileLen, int(reqObject["size"].(float64))) assert.Equal(t, evenLargerFileLen, int(reqObject["size"].(float64)))
retObject["size"] = evenLargerFileLen retObject["size"] = evenLargerFileLen
if op == "upload" { if op == "upload" {
retObject["actions"] = map[string]interface{}{ retObject["actions"] = map[string]interface{}{
Loading
@@ -1247,29 +1248,29 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1247,29 +1248,29 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
{ {
Path: "/evil-url", Path: "/evil-url",
Handler: func(_ http.ResponseWriter, _ *http.Request) { Handler: func(_ http.ResponseWriter, _ *http.Request) {
require.Fail(t, "An attacker accessed an evil URL") assert.Fail(t, "An attacker accessed an evil URL")
}, },
}, },
{ {
Path: fmt.Sprintf("/group/repo/gitlab-lfs/objects/%s", largeFileOid), Path: fmt.Sprintf("/group/repo/gitlab-lfs/objects/%s", largeFileOid),
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, "Basic 1234567890", r.Header.Get("Authorization")) assert.Equal(t, "Basic 1234567890", r.Header.Get("Authorization"))
w.Write([]byte(largeFileContents)) w.Write([]byte(largeFileContents))
}, },
}, },
{ {
Path: fmt.Sprintf("/group/repo/gitlab-lfs/objects/%s/%d", evenLargerFileOid, evenLargerFileLen), Path: fmt.Sprintf("/group/repo/gitlab-lfs/objects/%s/%d", evenLargerFileOid, evenLargerFileLen),
Handler: func(_ http.ResponseWriter, r *http.Request) { Handler: func(_ http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPut, r.Method) assert.Equal(t, http.MethodPut, r.Method)
require.Equal(t, "Basic 1234567890", r.Header.Get("Authorization")) assert.Equal(t, "Basic 1234567890", r.Header.Get("Authorization"))
body, _ := io.ReadAll(r.Body) body, _ := io.ReadAll(r.Body)
require.Equal(t, []byte(evenLargerFileContents), body) assert.Equal(t, []byte(evenLargerFileContents), body)
}, },
}, },
{ {
Path: "/group/repo/info/lfs/locks/verify", Path: "/group/repo/info/lfs/locks/verify",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
requestJSON := &struct { requestJSON := &struct {
Cursor string `json:"cursor"` Cursor string `json:"cursor"`
Limit int `json:"limit"` Limit int `json:"limit"`
Loading
@@ -1277,7 +1278,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1277,7 +1278,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Name string `json:"name"` Name string `json:"name"`
} `json:"ref"` } `json:"ref"`
}{} }{}
require.NoError(t, json.NewDecoder(r.Body).Decode(requestJSON)) assert.NoError(t, json.NewDecoder(r.Body).Decode(requestJSON))
bodyJSON := &struct { bodyJSON := &struct {
Ours []*LockInfo `json:"ours,omitempty"` Ours []*LockInfo `json:"ours,omitempty"`
Loading
@@ -1294,7 +1295,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1294,7 +1295,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
} }
} }
require.NoError(t, json.NewEncoder(w).Encode(bodyJSON)) assert.NoError(t, json.NewEncoder(w).Encode(bodyJSON))
}, },
}, },
{ {
Loading
@@ -1309,11 +1310,11 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1309,11 +1310,11 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
limit := 100 limit := 100
if r.URL.Query().Has("limit") { if r.URL.Query().Has("limit") {
l, err := strconv.Atoi(r.URL.Query().Get("limit")) l, err := strconv.Atoi(r.URL.Query().Get("limit"))
require.NoError(t, err) assert.NoError(t, err)
limit = l limit = l
} }
bodyJSON.Locks, bodyJSON.NextCursor = listLocks(r.URL.Query().Get("cursor"), limit, r.URL.Query().Get("refspec"), r.URL.Query().Get("id"), r.URL.Query().Get("path")) bodyJSON.Locks, bodyJSON.NextCursor = listLocks(r.URL.Query().Get("cursor"), limit, r.URL.Query().Get("refspec"), r.URL.Query().Get("id"), r.URL.Query().Get("path"))
require.NoError(t, json.NewEncoder(w).Encode(bodyJSON)) assert.NoError(t, json.NewEncoder(w).Encode(bodyJSON))
case http.MethodPost: case http.MethodPost:
var body map[string]interface{} var body map[string]interface{}
reader := json.NewDecoder(r.Body) reader := json.NewDecoder(r.Body)
Loading
@@ -1353,7 +1354,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1353,7 +1354,7 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
w.WriteHeader(http.StatusCreated) w.WriteHeader(http.StatusCreated)
case "/large/file/5": case "/large/file/5":
ref := body["ref"].(map[string]interface{}) ref := body["ref"].(map[string]interface{})
require.Equal(t, "refs/heads/main", ref["name"]) assert.Equal(t, "refs/heads/main", ref["name"])
response = map[string]interface{}{ response = map[string]interface{}{
"lock": map[string]interface{}{ "lock": map[string]interface{}{
"id": "lock5", "id": "lock5",
Loading
@@ -1379,10 +1380,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1379,10 +1380,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
{ {
Path: "/group/repo/info/lfs/locks/lock1/unlock", Path: "/group/repo/info/lfs/locks/lock1/unlock",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
var body map[string]interface{} var body map[string]interface{}
require.NoError(t, json.NewDecoder(r.Body).Decode(&body)) assert.NoError(t, json.NewDecoder(r.Body).Decode(&body))
require.Equal(t, map[string]interface{}{ assert.Equal(t, map[string]interface{}{
"ref": map[string]interface{}{ "ref": map[string]interface{}{
"name": "refs/heads/main", "name": "refs/heads/main",
}, },
Loading
@@ -1406,10 +1407,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1406,10 +1407,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
{ {
Path: "/group/repo/info/lfs/locks/lock2/unlock", Path: "/group/repo/info/lfs/locks/lock2/unlock",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
var body map[string]interface{} var body map[string]interface{}
require.NoError(t, json.NewDecoder(r.Body).Decode(&body)) assert.NoError(t, json.NewDecoder(r.Body).Decode(&body))
require.Equal(t, map[string]interface{}{ assert.Equal(t, map[string]interface{}{
"force": true, "force": true,
}, body) }, body)
Loading
@@ -1430,10 +1431,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1430,10 +1431,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
{ {
Path: "/group/repo/info/lfs/locks/lock3/unlock", Path: "/group/repo/info/lfs/locks/lock3/unlock",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
var body map[string]interface{} var body map[string]interface{}
require.NoError(t, json.NewDecoder(r.Body).Decode(&body)) assert.NoError(t, json.NewDecoder(r.Body).Decode(&body))
require.Equal(t, map[string]interface{}{ assert.Equal(t, map[string]interface{}{
"force": false, "force": false,
}, body) }, body)
Loading
@@ -1448,10 +1449,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
Loading
@@ -1448,10 +1449,10 @@ func setup(t *testing.T, keyID string, repo string, op string) (string, *Command
{ {
Path: "/group/repo/info/lfs/locks/lock4/unlock", Path: "/group/repo/info/lfs/locks/lock4/unlock",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method) assert.Equal(t, http.MethodPost, r.Method)
var body map[string]interface{} var body map[string]interface{}
require.NoError(t, json.NewDecoder(r.Body).Decode(&body)) assert.NoError(t, json.NewDecoder(r.Body).Decode(&body))
require.Equal(t, map[string]interface{}{ assert.Equal(t, map[string]interface{}{
"force": false, "force": false,
}, body) }, body)
Loading
Loading
Loading
@@ -9,6 +9,7 @@ import (
Loading
@@ -9,6 +9,7 @@ import (
"path" "path"
"testing" "testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
pb "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb" pb "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
Loading
@@ -258,26 +259,26 @@ func setup(t *testing.T, userResponses, keyResponses map[string]testResponse) *C
Loading
@@ -258,26 +259,26 @@ func setup(t *testing.T, userResponses, keyResponses map[string]testResponse) *C
Path: "/api/v4/internal/allowed", Path: "/api/v4/internal/allowed",
Handler: func(w http.ResponseWriter, r *http.Request) { Handler: func(w http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body) b, err := io.ReadAll(r.Body)
require.NoError(t, err) assert.NoError(t, err)
var requestBody *Request var requestBody *Request
require.NoError(t, json.Unmarshal(b, &requestBody)) assert.NoError(t, json.Unmarshal(b, &requestBody))
if tr, ok := userResponses[requestBody.Username]; ok { if tr, ok := userResponses[requestBody.Username]; ok {
w.WriteHeader(tr.status) w.WriteHeader(tr.status)
_, err := w.Write(tr.body) _, err := w.Write(tr.body)
require.NoError(t, err) assert.NoError(t, err)
require.Equal(t, namespace, requestBody.NamespacePath) assert.Equal(t, namespace, requestBody.NamespacePath)
} else if tr, ok := userResponses[requestBody.Krb5Principal]; ok { } else if tr, ok := userResponses[requestBody.Krb5Principal]; ok {
w.WriteHeader(tr.status) w.WriteHeader(tr.status)
_, err := w.Write(tr.body) _, err := w.Write(tr.body)
require.NoError(t, err) assert.NoError(t, err)
require.Equal(t, sshProtocol, requestBody.Protocol) assert.Equal(t, sshProtocol, requestBody.Protocol)
} else if tr, ok := keyResponses[requestBody.KeyID]; ok { } else if tr, ok := keyResponses[requestBody.KeyID]; ok {
w.WriteHeader(tr.status) w.WriteHeader(tr.status)
_, err := w.Write(tr.body) _, err := w.Write(tr.body)
require.NoError(t, err) assert.NoError(t, err)
require.Equal(t, sshProtocol, requestBody.Protocol) assert.Equal(t, sshProtocol, requestBody.Protocol)
} }
}, },
}, },
Loading
@@ -298,11 +299,11 @@ func setupWithAPIInspector(t *testing.T, inspector func(*Request)) *Client {
Loading
@@ -298,11 +299,11 @@ func setupWithAPIInspector(t *testing.T, inspector func(*Request)) *Client {
Path: "/api/v4/internal/allowed", Path: "/api/v4/internal/allowed",
Handler: func(_ http.ResponseWriter, r *http.Request) { Handler: func(_ http.ResponseWriter, r *http.Request) {
b, err := io.ReadAll(r.Body) b, err := io.ReadAll(r.Body)
require.NoError(t, err) assert.NoError(t, err)
var requestBody *Request var requestBody *Request
err = json.Unmarshal(b, &requestBody) err = json.Unmarshal(b, &requestBody)
require.NoError(t, err) assert.NoError(t, err)
inspector(requestBody) inspector(requestBody)
}, },
Loading
Loading
Loading
@@ -6,7 +6,7 @@ import (
Loading
@@ -6,7 +6,7 @@ import (
"net/http" "net/http"
"testing" "testing"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/assert"
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver" "gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
) )
Loading
@@ -22,7 +22,7 @@ func BuildDisallowedByAPIHandlers(t *testing.T) []testserver.TestRequestHandler
Loading
@@ -22,7 +22,7 @@ func BuildDisallowedByAPIHandlers(t *testing.T) []testserver.TestRequestHandler
"message": "Disallowed by API call", "message": "Disallowed by API call",
} }
w.WriteHeader(http.StatusForbidden) w.WriteHeader(http.StatusForbidden)
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
} }
Loading
@@ -60,7 +60,7 @@ func BuildAllowedWithGitalyHandlers(t *testing.T, gitalyAddress string) []testse
Loading
@@ -60,7 +60,7 @@ func BuildAllowedWithGitalyHandlers(t *testing.T, gitalyAddress string) []testse
}, },
}, },
} }
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
} }
Loading
@@ -87,21 +87,21 @@ func BuildAllowedWithCustomActionsHandlers(t *testing.T) []testserver.TestReques
Loading
@@ -87,21 +87,21 @@ func BuildAllowedWithCustomActionsHandlers(t *testing.T) []testserver.TestReques
}, },
} }
w.WriteHeader(http.StatusMultipleChoices) w.WriteHeader(http.StatusMultipleChoices)
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
{ {
Path: "/geo/proxy/info_refs", Path: "/geo/proxy/info_refs",
Handler: func(w http.ResponseWriter, _ *http.Request) { Handler: func(w http.ResponseWriter, _ *http.Request) {
body := map[string]interface{}{"result": []byte("custom")} body := map[string]interface{}{"result": []byte("custom")}
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
{ {
Path: "/geo/proxy/push", Path: "/geo/proxy/push",
Handler: func(w http.ResponseWriter, _ *http.Request) { Handler: func(w http.ResponseWriter, _ *http.Request) {
body := map[string]interface{}{"result": []byte("output")} body := map[string]interface{}{"result": []byte("output")}
require.NoError(t, json.NewEncoder(w).Encode(body)) assert.NoError(t, json.NewEncoder(w).Encode(body))
}, },
}, },
} }
Loading
Loading
client/client_test.go:24:2: var-naming: var defaultHttpOpts should be defaultHTTPOpts (revive) client/client_test.go:25:2: var-naming: var defaultHttpOpts should be defaultHTTPOpts (revive)
client/client_test.go:114:3: expected-actual: need to reverse actual and expected values (testifylint) client/client_test.go:115:3: expected-actual: need to reverse actual and expected values (testifylint)
client/client_test.go:136:30: response body must be closed (bodyclose) client/client_test.go:137:30: response body must be closed (bodyclose)
client/client_test.go:142:31: response body must be closed (bodyclose) client/client_test.go:143:31: response body must be closed (bodyclose)
client/client_test.go:150:30: response body must be closed (bodyclose) client/client_test.go:151:30: response body must be closed (bodyclose)
client/client_test.go:156:31: response body must be closed (bodyclose) client/client_test.go:157:31: response body must be closed (bodyclose)
client/client_test.go:164:30: response body must be closed (bodyclose) client/client_test.go:165:30: response body must be closed (bodyclose)
client/client_test.go:170:31: response body must be closed (bodyclose) client/client_test.go:171:31: response body must be closed (bodyclose)
client/client_test.go:182:72: unused-parameter: parameter 'token' seems to be unused, consider removing or renaming it as _ (revive) client/client_test.go:183:72: unused-parameter: parameter 'token' seems to be unused, consider removing or renaming it as _ (revive)
client/client_test.go:243:5: go-require: do not use require in http handlers (testifylint) client/client_test.go:276:41: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
client/client_test.go:251:5: go-require: do not use require in http handlers (testifylint) client/client_test.go:287:18: unused-parameter: parameter 'w' seems to be unused, consider removing or renaming it as _ (revive)
client/client_test.go:256:5: go-require: do not use require in http handlers (testifylint) client/client_test.go:305:73: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
client/client_test.go:275:41: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive) client/client_test.go:317:21: response body must be closed (bodyclose)
client/client_test.go:286:18: unused-parameter: parameter 'w' seems to be unused, consider removing or renaming it as _ (revive)
client/client_test.go:304:73: unused-parameter: parameter 'r' seems to be unused, consider removing or renaming it as _ (revive)
client/client_test.go:316:21: response body must be closed (bodyclose)
client/httpclient.go:209:22: G115: integer overflow conversion uint64 -> int64 (gosec) client/httpclient.go:209:22: G115: integer overflow conversion uint64 -> int64 (gosec)
client/httpclient_test.go:37:5: go-require: do not use require in http handlers (testifylint) client/httpsclient_test.go:63:4: expected-actual: need to reverse actual and expected values (testifylint)
client/httpclient_test.go:45:5: go-require: do not use require in http handlers (testifylint) client/httpsclient_test.go:106:24: response body must be closed (bodyclose)
client/httpclient_test.go:85:5: go-require: do not use require in http handlers (testifylint) client/httpsclient_test.go:109:5: expected-actual: need to reverse actual and expected values (testifylint)
client/httpclient_test.go:103:5: go-require: do not use require in http handlers (testifylint)
client/httpclient_test.go:109:5: go-require: do not use require in http handlers (testifylint)
client/httpsclient_test.go:62:4: expected-actual: need to reverse actual and expected values (testifylint)
client/httpsclient_test.go:105:24: response body must be closed (bodyclose)
client/httpsclient_test.go:108:5: expected-actual: need to reverse actual and expected values (testifylint)
client/httpsclient_test.go:119:5: go-require: do not use require in http handlers (testifylint)
client/testserver/gitalyserver.go:1:1: package-comments: should have a package comment (revive) client/testserver/gitalyserver.go:1:1: package-comments: should have a package comment (revive)
client/testserver/gitalyserver.go:21:6: exported: exported type TestGitalyServer should have comment or be unexported (revive) client/testserver/gitalyserver.go:21:6: exported: exported type TestGitalyServer should have comment or be unexported (revive)
client/testserver/gitalyserver.go:26:1: exported: exported method TestGitalyServer.SSHReceivePack should have comment or be unexported (revive) client/testserver/gitalyserver.go:26:1: exported: exported method TestGitalyServer.SSHReceivePack should have comment or be unexported (revive)
Loading
@@ -47,12 +38,6 @@ cmd/gitlab-shell/main.go:48:15: Error return value of `fmt.Fprintln` is not chec
Loading
@@ -47,12 +38,6 @@ cmd/gitlab-shell/main.go:48:15: Error return value of `fmt.Fprintln` is not chec
cmd/gitlab-shell/main.go:53:23: Error return value of `logCloser.Close` is not checked (errcheck) cmd/gitlab-shell/main.go:53:23: Error return value of `logCloser.Close` is not checked (errcheck)
cmd/gitlab-shell/main.go:60:14: Error return value of `fmt.Fprintf` is not checked (errcheck) cmd/gitlab-shell/main.go:60:14: Error return value of `fmt.Fprintf` is not checked (errcheck)
cmd/gitlab-shell/main.go:61:3: exitAfterDefer: os.Exit will exit, and `defer logCloser.Close()` will not run (gocritic) cmd/gitlab-shell/main.go:61:3: exitAfterDefer: os.Exit will exit, and `defer logCloser.Close()` will not run (gocritic)
cmd/gitlab-sshd/acceptance_test.go:115:6: go-require: do not use require in http handlers (testifylint)
cmd/gitlab-sshd/acceptance_test.go:125:5: go-require: do not use require in http handlers (testifylint)
cmd/gitlab-sshd/acceptance_test.go:132:5: go-require: do not use require in http handlers (testifylint)
cmd/gitlab-sshd/acceptance_test.go:135:5: go-require: do not use require in http handlers (testifylint)
cmd/gitlab-sshd/acceptance_test.go:188:4: go-require: do not use require in http handlers (testifylint)
cmd/gitlab-sshd/acceptance_test.go:498:4: go-require: do not use require in http handlers (testifylint)
internal/command/authorizedkeys/authorized_keys.go:29: internal/command/authorizedkeys/authorized_keys.go:29: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "TODO: Log this event once we have a cons..." (godox) internal/command/authorizedkeys/authorized_keys.go:29: internal/command/authorizedkeys/authorized_keys.go:29: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "TODO: Log this event once we have a cons..." (godox)
internal/command/command.go:1:1: package-comments: should have a package comment (revive) internal/command/command.go:1:1: package-comments: should have a package comment (revive)
internal/command/command.go:15:6: exported: exported type Command should have comment or be unexported (revive) internal/command/command.go:15:6: exported: exported type Command should have comment or be unexported (revive)
Loading
@@ -91,13 +76,6 @@ internal/command/commandargs/shell.go:69:6: var-naming: var keyId should be keyI
Loading
@@ -91,13 +76,6 @@ internal/command/commandargs/shell.go:69:6: var-naming: var keyId should be keyI
internal/command/commandargs/shell.go:98:6: var-naming: func tryParseKeyId should be tryParseKeyID (revive) internal/command/commandargs/shell.go:98:6: var-naming: func tryParseKeyId should be tryParseKeyID (revive)
internal/command/commandargs/shell.go:106:1: exported: exported method Shell.ParseCommand should have comment or be unexported (revive) internal/command/commandargs/shell.go:106:1: exported: exported method Shell.ParseCommand should have comment or be unexported (revive)
internal/command/lfsauthenticate/lfsauthenticate.go:87:13: Error return value of `fmt.Fprintf` is not checked (errcheck) internal/command/lfsauthenticate/lfsauthenticate.go:87:13: Error return value of `fmt.Fprintf` is not checked (errcheck)
internal/command/lfsauthenticate/lfsauthenticate_test.go:76:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfsauthenticate/lfsauthenticate_test.go:79:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfsauthenticate/lfsauthenticate_test.go:80:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfsauthenticate/lfsauthenticate_test.go:89:6: go-require: do not use require in http handlers (testifylint)
internal/command/lfsauthenticate/lfsauthenticate_test.go:100:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfsauthenticate/lfsauthenticate_test.go:103:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfsauthenticate/lfsauthenticate_test.go:122:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/gitlab_backend.go:40:6: exported: exported type GitlabAuthentication should have comment or be unexported (revive) internal/command/lfstransfer/gitlab_backend.go:40:6: exported: exported type GitlabAuthentication should have comment or be unexported (revive)
internal/command/lfstransfer/gitlab_backend.go:45:6: exported: exported type GitlabBackend should have comment or be unexported (revive) internal/command/lfstransfer/gitlab_backend.go:45:6: exported: exported type GitlabBackend should have comment or be unexported (revive)
internal/command/lfstransfer/gitlab_backend.go:60:1: exported: exported function NewGitlabBackend should have comment or be unexported (revive) internal/command/lfstransfer/gitlab_backend.go:60:1: exported: exported function NewGitlabBackend should have comment or be unexported (revive)
Loading
@@ -111,38 +89,8 @@ internal/command/lfstransfer/lfstransfer.go:32: Function 'Execute' is too long (
Loading
@@ -111,38 +89,8 @@ internal/command/lfstransfer/lfstransfer.go:32: Function 'Execute' is too long (
internal/command/lfstransfer/lfstransfer.go:52:20: context-keys-type: should not use basic type string as key in context.WithValue (revive) internal/command/lfstransfer/lfstransfer.go:52:20: context-keys-type: should not use basic type string as key in context.WithValue (revive)
internal/command/lfstransfer/lfstransfer.go:114:9: composites: gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/shared/accessverifier.Command struct literal uses unkeyed fields (govet) internal/command/lfstransfer/lfstransfer.go:114:9: composites: gitlab.com/gitlab-org/gitlab-shell/v14/internal/command/shared/accessverifier.Command struct literal uses unkeyed fields (govet)
internal/command/lfstransfer/lfstransfer_test.go:19:2: import 'github.com/git-lfs/pktline' is not allowed from list 'test' (depguard) internal/command/lfstransfer/lfstransfer_test.go:19:2: import 'github.com/git-lfs/pktline' is not allowed from list 'test' (depguard)
internal/command/lfstransfer/lfstransfer_test.go:49:3: go-require: require must only be used in the goroutine running the test function (testifylint) internal/command/lfstransfer/lfstransfer_test.go:278:2: declaration has 3 blank identifiers (dogsled)
internal/command/lfstransfer/lfstransfer_test.go:277:2: declaration has 3 blank identifiers (dogsled) internal/command/lfstransfer/lfstransfer_test.go:1114:1: cognitive complexity 33 of func `setup` is high (> 20) (gocognit)
internal/command/lfstransfer/lfstransfer_test.go:1113:1: cognitive complexity 33 of func `setup` is high (> 20) (gocognit)
internal/command/lfstransfer/lfstransfer_test.go:1162:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1170:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1173:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1181:6: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1190:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1217:7: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1250:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1256:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1263:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1264:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1266:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1272:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1280:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1297:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1312:7: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1316:6: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1356:7: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1382:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1384:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1385:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1409:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1411:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1412:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1433:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1435:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1436:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1451:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1453:5: go-require: do not use require in http handlers (testifylint)
internal/command/lfstransfer/lfstransfer_test.go:1454:5: go-require: do not use require in http handlers (testifylint)
internal/command/readwriter/readwriter.go:1:1: package-comments: should have a package comment (revive) internal/command/readwriter/readwriter.go:1:1: package-comments: should have a package comment (revive)
internal/command/readwriter/readwriter.go:7:6: exported: exported type ReadWriter should have comment or be unexported (revive) internal/command/readwriter/readwriter.go:7:6: exported: exported type ReadWriter should have comment or be unexported (revive)
internal/command/receivepack/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple) internal/command/receivepack/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple)
Loading
@@ -181,16 +129,6 @@ internal/gitaly/gitaly.go:34:6: exported: exported type Client should have comme
Loading
@@ -181,16 +129,6 @@ internal/gitaly/gitaly.go:34:6: exported: exported type Client should have comme
internal/gitaly/gitaly.go:40:1: exported: exported method Client.InitSidechannelRegistry should have comment or be unexported (revive) internal/gitaly/gitaly.go:40:1: exported: exported method Client.InitSidechannelRegistry should have comment or be unexported (revive)
internal/gitaly/gitaly.go:44:1: exported: exported method Client.GetConnection should have comment or be unexported (revive) internal/gitaly/gitaly.go:44:1: exported: exported method Client.GetConnection should have comment or be unexported (revive)
internal/gitaly/gitaly.go:56:5: shadow: declaration of "conn" shadows declaration at line 46 (govet) internal/gitaly/gitaly.go:56:5: shadow: declaration of "conn" shadows declaration at line 46 (govet)
internal/gitlabnet/accessverifier/client_test.go:261:5: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:264:5: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:269:6: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:270:6: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:274:6: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:275:6: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:279:6: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:280:6: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:301:5: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/accessverifier/client_test.go:305:5: go-require: do not use require in http handlers (testifylint)
internal/gitlabnet/client.go:1:1: package-comments: should have a package comment (revive) internal/gitlabnet/client.go:1:1: package-comments: should have a package comment (revive)
internal/gitlabnet/client.go:14:1: exported: exported function GetClient should have comment or be unexported (revive) internal/gitlabnet/client.go:14:1: exported: exported function GetClient should have comment or be unexported (revive)
internal/gitlabnet/client.go:21:15: ST1005: error strings should not be capitalized (stylecheck) internal/gitlabnet/client.go:21:15: ST1005: error strings should not be capitalized (stylecheck)
Loading
@@ -200,8 +138,3 @@ internal/gitlabnet/healthcheck/client_test.go:19:41: unused-parameter: parameter
Loading
@@ -200,8 +138,3 @@ internal/gitlabnet/healthcheck/client_test.go:19:41: unused-parameter: parameter
internal/gitlabnet/lfstransfer/client.go:137: internal/gitlabnet/lfstransfer/client.go:137: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "FIXME: This causes tests to fail" (godox) internal/gitlabnet/lfstransfer/client.go:137: internal/gitlabnet/lfstransfer/client.go:137: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "FIXME: This causes tests to fail" (godox)
internal/sshd/server_config_test.go:5:2: SA1019: "crypto/dsa" has been deprecated since Go 1.16 because it shouldn't be used: DSA is a legacy algorithm, and modern alternatives such as Ed25519 (implemented by package crypto/ed25519) should be used instead. Keys with 1024-bit moduli (L1024N160 parameters) are cryptographically weak, while bigger keys are not widely supported. Note that FIPS 186-5 no longer approves DSA for signature generation. (staticcheck) internal/sshd/server_config_test.go:5:2: SA1019: "crypto/dsa" has been deprecated since Go 1.16 because it shouldn't be used: DSA is a legacy algorithm, and modern alternatives such as Ed25519 (implemented by package crypto/ed25519) should be used instead. Keys with 1024-bit moduli (L1024N160 parameters) are cryptographically weak, while bigger keys are not widely supported. Note that FIPS 186-5 no longer approves DSA for signature generation. (staticcheck)
internal/sshd/sshd.go:268:6: func `extractDataFromContext` is unused (unused) internal/sshd/sshd.go:268:6: func `extractDataFromContext` is unused (unused)
internal/testhelper/requesthandlers/requesthandlers.go:25:5: go-require: do not use require in http handlers (testifylint)
internal/testhelper/requesthandlers/requesthandlers.go:63:5: go-require: do not use require in http handlers (testifylint)
internal/testhelper/requesthandlers/requesthandlers.go:90:5: go-require: do not use require in http handlers (testifylint)
internal/testhelper/requesthandlers/requesthandlers.go:97:5: go-require: do not use require in http handlers (testifylint)
internal/testhelper/requesthandlers/requesthandlers.go:104:5: go-require: do not use require in http handlers (testifylint)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment