Skip to content

Commit 13f3194

Browse files
committed
Lint fixes in accessverifier package
1 parent cffe8fc commit 13f3194

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

internal/command/shared/accessverifier/accessverifier.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Package accessverifier handles the verification of access permission.
12
package accessverifier
23

34
import (
@@ -11,14 +12,17 @@ import (
1112
"gitlab.com/gitlab-org/gitlab-shell/v14/internal/gitlabnet/accessverifier"
1213
)
1314

15+
// Response is an alias for accessverifier.Response, representing the result of an access verification.
1416
type Response = accessverifier.Response
1517

18+
// Command handles access verification commands.
1619
type Command struct {
1720
Config *config.Config
1821
Args *commandargs.Shell
1922
ReadWriter *readwriter.ReadWriter
2023
}
2124

25+
// Verify checks access permissions and returns a response.
2226
func (c *Command) Verify(ctx context.Context, action commandargs.CommandType, repo string) (*Response, error) {
2327
client, err := accessverifier.NewClient(c.Config)
2428
if err != nil {

internal/command/shared/accessverifier/accessverifier_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net/http"
99
"testing"
1010

11+
"github.com/stretchr/testify/assert"
1112
"github.com/stretchr/testify/require"
1213

1314
"gitlab.com/gitlab-org/gitlab-shell/v14/client/testserver"
@@ -28,23 +29,23 @@ func setup(t *testing.T) (*Command, *bytes.Buffer, *bytes.Buffer) {
2829
Path: "/api/v4/internal/allowed",
2930
Handler: func(w http.ResponseWriter, r *http.Request) {
3031
b, err := io.ReadAll(r.Body)
31-
require.NoError(t, err)
32+
assert.NoError(t, err)
3233

3334
var requestBody *accessverifier.Request
3435
err = json.Unmarshal(b, &requestBody)
35-
require.NoError(t, err)
36+
assert.NoError(t, err)
3637

3738
if requestBody.KeyID == "1" {
3839
body := map[string]interface{}{
3940
"gl_console_messages": []string{"console", "message"},
4041
}
41-
require.NoError(t, json.NewEncoder(w).Encode(body))
42+
assert.NoError(t, json.NewEncoder(w).Encode(body))
4243
} else {
4344
body := map[string]interface{}{
4445
"status": false,
4546
"message": "missing user",
4647
}
47-
require.NoError(t, json.NewEncoder(w).Encode(body))
48+
assert.NoError(t, json.NewEncoder(w).Encode(body))
4849
}
4950
},
5051
},

support/lint_last_known_acceptable.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,6 @@ internal/command/readwriter/readwriter.go:7:6: exported: exported type ReadWrite
208208
internal/command/receivepack/gitalycall_test.go:24:4: S1038: should use t.Logf(...) instead of t.Log(fmt.Sprintf(...)) (gosimple)
209209
internal/command/receivepack/gitalycall_test.go:31:5: var-naming: struct field keyId should be keyID (revive)
210210
internal/command/receivepack/gitalycall_test.go:98:5: expected-actual: need to reverse actual and expected values (testifylint)
211-
internal/command/shared/accessverifier/accessverifier.go:1:1: package-comments: should have a package comment (revive)
212-
internal/command/shared/accessverifier/accessverifier.go:14:6: exported: exported type Response should have comment or be unexported (revive)
213-
internal/command/shared/accessverifier/accessverifier.go:16:6: exported: exported type Command should have comment or be unexported (revive)
214-
internal/command/shared/accessverifier/accessverifier.go:22:1: exported: exported method Command.Verify should have comment or be unexported (revive)
215-
internal/command/shared/accessverifier/accessverifier_test.go:31:5: go-require: do not use require in http handlers (testifylint)
216-
internal/command/shared/accessverifier/accessverifier_test.go:35:5: go-require: do not use require in http handlers (testifylint)
217-
internal/command/shared/accessverifier/accessverifier_test.go:41:6: go-require: do not use require in http handlers (testifylint)
218-
internal/command/shared/accessverifier/accessverifier_test.go:47:6: go-require: do not use require in http handlers (testifylint)
219211
internal/command/shared/customaction/customaction_test.go:27:5: go-require: do not use require in http handlers (testifylint)
220212
internal/command/shared/customaction/customaction_test.go:30:5: go-require: do not use require in http handlers (testifylint)
221213
internal/command/shared/customaction/customaction_test.go:32:5: go-require: do not use require in http handlers (testifylint)

0 commit comments

Comments
 (0)