gitlabhq/gitlab-shell

View on GitHub
internal/command/lfstransfer/lfstransfer_test.go

Summary

Maintainability
F
1 wk
Test Coverage

File lfstransfer_test.go has 1334 lines of code (exceeds 500 allowed). Consider refactoring.
Open

package lfstransfer

import (
    "context"
    "crypto/hmac"
Severity: Major
Found in internal/command/lfstransfer/lfstransfer_test.go - About 2 days to fix

    Function setup has 350 lines of code (exceeds 50 allowed). Consider refactoring.
    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{
    Severity: Major
    Found in internal/command/lfstransfer/lfstransfer_test.go - About 1 day to fix

      Function TestLfsTransferGetObject has 153 lines of code (exceeds 50 allowed). Consider refactoring.
      Open

      func TestLfsTransferGetObject(t *testing.T) {
          url, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
          wg := setupWaitGroupForExecute(t, cmd)
          negotiateVersion(t, pl)
      
      
      Severity: Major
      Found in internal/command/lfstransfer/lfstransfer_test.go - About 5 hrs to fix

        Function TestLfsTransferPutObject has 149 lines of code (exceeds 50 allowed). Consider refactoring.
        Open

        func TestLfsTransferPutObject(t *testing.T) {
            url, cmd, pl, _ := setup(t, "rw", "group/repo", "upload")
            wg := setupWaitGroupForExecute(t, cmd)
            negotiateVersion(t, pl)
        
        
        Severity: Major
        Found in internal/command/lfstransfer/lfstransfer_test.go - About 4 hrs to fix

          Function setup has a Cognitive Complexity of 33 (exceeds 20 allowed). Consider refactoring.
          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{
          Severity: Minor
          Found in internal/command/lfstransfer/lfstransfer_test.go - About 2 hrs to fix

          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

          func TestLfsTransferListLockUpload(t *testing.T) {
              _, cmd, pl, _ := setup(t, "rw", "group/repo", "upload")
              wg := setupWaitGroupForExecute(t, cmd)
              negotiateVersion(t, pl)
          
          
          Severity: Major
          Found in internal/command/lfstransfer/lfstransfer_test.go - About 2 hrs to fix

            Function TestLfsTransferListLockDownload has 73 lines of code (exceeds 50 allowed). Consider refactoring.
            Open

            func TestLfsTransferListLockDownload(t *testing.T) {
                _, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
                wg := setupWaitGroupForExecute(t, cmd)
                negotiateVersion(t, pl)
            
            
            Severity: Minor
            Found in internal/command/lfstransfer/lfstransfer_test.go - About 1 hr to fix

              Function listLocks has 59 lines of code (exceeds 50 allowed). Consider refactoring.
              Open

              func listLocks(cursor string, limit int, refspec string, id string, path string) (locks []*LockInfo, nextCursor string) {
                  allLocks := []struct {
                      Refspec string
                      *LockInfo
                  }{
              Severity: Minor
              Found in internal/command/lfstransfer/lfstransfer_test.go - About 1 hr to fix

                Function TestLfsTransferBatchDownload has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func TestLfsTransferBatchDownload(t *testing.T) {
                    url, cmd, pl, _ := setup(t, "rw", "group/repo", "download")
                    wg := setupWaitGroupForExecute(t, cmd)
                    negotiateVersion(t, pl)
                
                
                Severity: Minor
                Found in internal/command/lfstransfer/lfstransfer_test.go - About 1 hr to fix

                  Function TestLfsTransferBatchUpload has 54 lines of code (exceeds 50 allowed). Consider refactoring.
                  Open

                  func TestLfsTransferBatchUpload(t *testing.T) {
                      url, cmd, pl, _ := setup(t, "rw", "group/repo", "upload")
                      wg := setupWaitGroupForExecute(t, cmd)
                      negotiateVersion(t, pl)
                  
                  
                  Severity: Minor
                  Found in internal/command/lfstransfer/lfstransfer_test.go - About 1 hr to fix

                    Function listLocks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    func listLocks(cursor string, limit int, refspec string, id string, path string) (locks []*LockInfo, nextCursor string) {
                    Severity: Minor
                    Found in internal/command/lfstransfer/lfstransfer_test.go - About 35 mins to fix

                      Function writeCommandArgsAndTextData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      func writeCommandArgsAndTextData(t *testing.T, pl *pktline.Pktline, command string, args []string, data []string) {
                      Severity: Minor
                      Found in internal/command/lfstransfer/lfstransfer_test.go - About 35 mins to fix

                        Function writeCommandArgsAndBinaryData has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        func writeCommandArgsAndBinaryData(t *testing.T, pl *pktline.Pktline, command string, args []string, data [][]byte) {
                        Severity: Minor
                        Found in internal/command/lfstransfer/lfstransfer_test.go - About 35 mins to fix

                          There are no issues that match your filters.

                          Category
                          Status