Skip to content
代码片段 群组 项目
未验证 提交 63b0cba2 编辑于 作者: Archish Thakkar's avatar Archish Thakkar 提交者: GitLab
浏览文件

Lint issue in upload objectstore

上级 7e987f8d
No related branches found
No related tags found
无相关合并请求
......@@ -189,17 +189,12 @@ internal/upload/destination/destination.go:72: internal/upload/destination/desti
internal/upload/destination/destination.go:117: Function 'Upload' has too many statements (49 > 40) (funlen)
internal/upload/destination/multi_hash.go:4:2: G501: Blocklisted import crypto/md5: weak cryptographic primitive (gosec)
internal/upload/destination/multi_hash.go:5:2: G505: Blocklisted import crypto/sha1: weak cryptographic primitive (gosec)
internal/upload/destination/objectstore/object_test.go:127:4: go-require: do not use assert.FailNow in http handlers (testifylint)
internal/upload/destination/objectstore/test/objectstore_stub.go:4:2: G501: Blocklisted import crypto/md5: weak cryptographic primitive (gosec)
internal/upload/destination/objectstore/test/objectstore_stub.go:169:13: G401: Use of weak cryptographic primitive (gosec)
internal/upload/destination/objectstore/upload_strategy.go:29: internal/upload/destination/objectstore/upload_strategy.go:29: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "TODO: consider adding the context to the..." (godox)
internal/upload/destination/objectstore/uploader.go:5:2: G501: Blocklisted import crypto/md5: weak cryptographic primitive (gosec)
internal/upload/destination/objectstore/uploader.go:95:12: G401: Use of weak cryptographic primitive (gosec)
internal/upload/exif/exif.go:103:10: G204: Subprocess launched with variable (gosec)
internal/upload/uploads.go:62:16: Error return value of `fmt.Fprintln` is not checked (errcheck)
internal/upload/uploads.go:101:15: Error return value of `fmt.Fprintln` is not checked (errcheck)
internal/upload/uploads_test.go:527:3: negative-positive: use assert.Positive (testifylint)
internal/upload/uploads_test.go:545:3: negative-positive: use assert.Positive (testifylint)
internal/upstream/routes.go:170:74: `(*upstream).wsRoute` - `matchers` always receives `nil` (unparam)
internal/upstream/routes.go:230: Function 'configureRoutes' is too long (333 > 60) (funlen)
internal/upstream/routes.go:479: internal/upstream/routes.go:479: Line contains TODO/BUG/FIXME/NOTE/OPTIMIZE/HACK: "TODO: We should probably not return a HT..." (godox)
......
......@@ -124,7 +124,7 @@ func TestObjectUploadBrokenConnection(t *testing.T) {
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
hj, ok := w.(http.Hijacker)
if !ok {
assert.FailNow(t, "webserver doesn't support hijacking")
assert.Fail(t, "webserver doesn't support hijacking")
}
conn, _, err := hj.Hijack()
if err != nil {
......
......@@ -59,7 +59,7 @@ func interceptMultipartFiles(w http.ResponseWriter, r *http.Request, h http.Hand
writer := multipart.NewWriter(&body)
defer func() {
if writerErr := writer.Close(); writerErr != nil {
fmt.Fprintln(w, writerErr.Error())
_, _ = fmt.Fprintln(w, writerErr.Error())
}
}()
......@@ -98,7 +98,7 @@ func interceptMultipartFiles(w http.ResponseWriter, r *http.Request, h http.Hand
// Close writer
if writerErr := writer.Close(); writerErr != nil {
fmt.Fprintln(w, writerErr.Error())
_, _ = fmt.Fprintln(w, writerErr.Error())
}
// Hijack the request
......
......@@ -524,7 +524,7 @@ func TestUploadHandlerRemovingExif(t *testing.T) {
size, err := strconv.Atoi(r.FormValue("file.size"))
assert.NoError(t, err)
assert.Less(t, size, len(content), "Expected the file to be smaller after removal of exif")
assert.Greater(t, size, 0, "Expected to receive non-empty file")
assert.Positive(t, size, 0, "Expected to receive non-empty file")
w.WriteHeader(200)
fmt.Fprint(w, "RESPONSE")
......@@ -542,7 +542,7 @@ func TestUploadHandlerRemovingExifTiff(t *testing.T) {
size, err := strconv.Atoi(r.FormValue("file.size"))
assert.NoError(t, err)
assert.Less(t, size, len(content), "Expected the file to be smaller after removal of exif")
assert.Greater(t, size, 0, "Expected to receive not empty file")
assert.Positive(t, size, 0, "Expected to receive not empty file")
w.WriteHeader(200)
fmt.Fprint(w, "RESPONSE")
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册