wisedog/ladybug

View on GitHub
controllers/testexecs.go

Summary

Maintainability
B
4 hrs
Test Coverage

Function ExecUpdateResult has 79 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func ExecUpdateResult(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request) error {
    var rv models.TestCaseResult

    if err := r.ParseForm(); err != nil {
        log.Error("TestExec", "type", "http", "msg ", err)
Severity: Major
Found in controllers/testexecs.go - About 2 hrs to fix

    Function ExecUpdateResult has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
    Open

    func ExecUpdateResult(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request) error {
        var rv models.TestCaseResult
    
        if err := r.ParseForm(); err != nil {
            log.Error("TestExec", "type", "http", "msg ", err)
    Severity: Minor
    Found in controllers/testexecs.go - About 1 hr 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 ExecDone has 7 return statements (exceeds 4 allowed).
    Open

    func ExecDone(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request) error {
    
        if err := r.ParseForm(); err != nil {
            log.Error("TestExec", "type", "http", "msg ", err)
            return errors.HttpError{Status: http.StatusInternalServerError, Desc: "ParseForm failed"}
    Severity: Major
    Found in controllers/testexecs.go - About 45 mins to fix

      Function ExecUpdateResult has 7 return statements (exceeds 4 allowed).
      Open

      func ExecUpdateResult(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request) error {
          var rv models.TestCaseResult
      
          if err := r.ParseForm(); err != nil {
              log.Error("TestExec", "type", "http", "msg ", err)
      Severity: Major
      Found in controllers/testexecs.go - About 45 mins to fix

        Your code does not pass gofmt in 2 places. Go fmt your code!
        Open

        package controllers
        Severity: Minor
        Found in controllers/testexecs.go by gofmt

        There are no issues that match your filters.

        Category
        Status