internal/command/lfstransfer/lfstransfer_test.go
File lfstransfer_test.go
has 1334 lines of code (exceeds 500 allowed). Consider refactoring. Open
Open
package lfstransfer
import (
"context"
"crypto/hmac"
Function setup
has 350 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func setup(t *testing.T, keyID string, repo string, op string) (string, *Command, *pktline.Pktline, *io.PipeReader) {
var url string
gitalyAddress, _ := testserver.StartGitalyServer(t, "unix")
requests := []testserver.TestRequestHandler{
Function TestLfsTransferGetObject
has 153 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLfsTransferGetObject(t *testing.T) {
url, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function TestLfsTransferPutObject
has 149 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLfsTransferPutObject(t *testing.T) {
url, cmd, pl, _ := setup(t, "rw", "group/repo", "upload")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function setup
has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring. Open
Open
func setup(t *testing.T, keyID string, repo string, op string) (string, *Command, *pktline.Pktline, *io.PipeReader) {
var url string
gitalyAddress, _ := testserver.StartGitalyServer(t, "unix")
requests := []testserver.TestRequestHandler{
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function TestLfsTransferListLockUpload
has 82 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLfsTransferListLockUpload(t *testing.T) {
_, cmd, pl, _ := setup(t, "rw", "group/repo", "upload")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function TestLfsTransferListLockDownload
has 73 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLfsTransferListLockDownload(t *testing.T) {
_, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function listLocks
has 59 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func listLocks(cursor string, limit int, refspec string, id string, path string) (locks []*LockInfo, nextCursor string) {
allLocks := []struct {
Refspec string
*LockInfo
}{
Function TestLfsTransferBatchDownload
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLfsTransferBatchDownload(t *testing.T) {
url, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function TestLfsTransferBatchUpload
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestLfsTransferBatchUpload(t *testing.T) {
url, cmd, pl, _ := setup(t, "rw", "group/repo", "upload")
wg := setupWaitGroupForExecute(t, cmd)
negotiateVersion(t, pl)
Function listLocks
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func listLocks(cursor string, limit int, refspec string, id string, path string) (locks []*LockInfo, nextCursor string) {
Function writeCommandArgsAndTextData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func writeCommandArgsAndTextData(t *testing.T, pl *pktline.Pktline, command string, args []string, data []string) {
Function writeCommandArgsAndBinaryData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
func writeCommandArgsAndBinaryData(t *testing.T, pl *pktline.Pktline, command string, args []string, data [][]byte) {