seanlaidlaw/iRODS-Downloader

View on GitHub

Showing 5 of 87 total issues

Function main has a Cognitive Complexity of 284 (exceeds 20 allowed). Consider refactoring.
Open

func main() {
    // we want to load a config file named "irods_downloader_config.yaml" if it exists in WD or in ~/.config
    viper.SetConfigName("irods_downloader_config")
    viper.SetConfigType("yaml")
    viper.AddConfigPath(".")              // look for config in the working directory first
Severity: Minor
Found in irods_downloader.go - About 5 days 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 main has 566 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {
    // we want to load a config file named "irods_downloader_config.yaml" if it exists in WD or in ~/.config
    viper.SetConfigName("irods_downloader_config")
    viper.SetConfigType("yaml")
    viper.AddConfigPath(".")              // look for config in the working directory first
Severity: Major
Found in irods_downloader.go - About 2 days to fix

    File irods_downloader.go has 686 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    package main
    
    import (
        "bytes"
        "encoding/json"
    Severity: Minor
    Found in irods_downloader.go - About 6 hrs to fix

      Function main has 8 return statements (exceeds 4 allowed).
      Open

      func main() {
          // we want to load a config file named "irods_downloader_config.yaml" if it exists in WD or in ~/.config
          viper.SetConfigName("irods_downloader_config")
          viper.SetConfigType("yaml")
          viper.AddConfigPath(".")              // look for config in the working directory first
      Severity: Major
      Found in irods_downloader.go - About 50 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if err != nil {
                                // Display everything we got if error.
                                log.Println("Error when running command.  Output:")
                                log.Println(string(output))
                                log.Printf("Got command status: %s\n", err.Error())
        Severity: Major
        Found in irods_downloader.go - About 45 mins to fix
          Severity
          Category
          Status
          Source
          Language