18F/cg-sandbox

View on GitHub

Showing 4 of 16 total issues

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

func main() {
    var opts Options
    if err := envconfig.Process("", &opts); err != nil {
        log.Fatalf("error parsing options: %s", err.Error())
    }
Severity: Minor
Found in cmd/purge/main.go - About 1 day 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 127 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func main() {
    var opts Options
    if err := envconfig.Process("", &opts); err != nil {
        log.Fatalf("error parsing options: %s", err.Error())
    }
Severity: Major
Found in cmd/purge/main.go - About 4 hrs to fix

    Function ListPurgeSpaces has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        spaces []cfclient.Space,
        apps []cfclient.App,
        instances []cfclient.ServiceInstance,
        now time.Time,
        notifyThreshold int,
    Severity: Major
    Found in sandbox/sandbox.go - About 50 mins to fix

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

          opts SMTPOptions,
          sender string,
          subject string,
          body string,
          recipients []string,
      Severity: Minor
      Found in sandbox/sandbox.go - About 35 mins to fix
        Severity
        Category
        Status
        Source
        Language