abzcoding/hget

View on GitHub
http.go

Summary

Maintainability
C
7 hrs
Test Coverage

Method HTTPDownloader.Do has a Cognitive Complexity of 40 (exceeds 20 allowed). Consider refactoring.
Open

func (d *HTTPDownloader) Do(doneChan chan bool, fileChan chan string, errorChan chan error, interruptChan chan bool, stateSaveChan chan Part) {
    var ws sync.WaitGroup
    var bars []*pb.ProgressBar
    var barpool *pb.Pool
    var err error
Severity: Minor
Found in http.go - About 3 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

Method HTTPDownloader.Do has 101 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (d *HTTPDownloader) Do(doneChan chan bool, fileChan chan string, errorChan chan error, interruptChan chan bool, stateSaveChan chan Part) {
    var ws sync.WaitGroup
    var bars []*pb.ProgressBar
    var barpool *pb.Pool
    var err error
Severity: Major
Found in http.go - About 3 hrs to fix

    Function NewHTTPDownloader has 52 lines of code (exceeds 50 allowed). Consider refactoring.
    Open

    func NewHTTPDownloader(url string, par int, skipTLS bool, proxyServer string, bwLimit string) *HTTPDownloader {
        var resumable = true
        client := ProxyAwareHTTPClient(proxyServer)
    
        parsed, err := stdurl.Parse(url)
    Severity: Minor
    Found in http.go - About 1 hr to fix

      Method HTTPDownloader.Do has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Wontfix

      func (d *HTTPDownloader) Do(doneChan chan bool, fileChan chan string, errorChan chan error, interruptChan chan bool, stateSaveChan chan Part) {
      Severity: Minor
      Found in http.go - About 35 mins to fix

        Function NewHTTPDownloader has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Wontfix

        func NewHTTPDownloader(url string, par int, skipTLS bool, proxyServer string, bwLimit string) *HTTPDownloader {
        Severity: Minor
        Found in http.go - About 35 mins to fix

          2: cannot find package "github.com/alecthomas/units" in any of:
          Wontfix

              "github.com/alecthomas/units"
          Severity: Minor
          Found in http.go by govet

          There are no issues that match your filters.

          Category
          Status