wisedog/ladybug

View on GitHub
controllers/testcases.go

Summary

Maintainability
B
6 hrs
Test Coverage

Function findDiff has 90 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func findDiff(c *interfacer.AppContext, existCase, newCase *models.TestCase, note string, user *models.User) {

    var changes []models.HistoryTestCaseUnit
    his := models.History{Category: models.HISTORY_TYPE_TC,
        TargetID: existCase.ID, UserID: user.ID,
Severity: Major
Found in controllers/testcases.go - About 2 hrs to fix

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

    func handleSaveUpdate(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request, isUpdate bool) error {
    
        var testcase models.TestCase
        vars := mux.Vars(r)
        projectName := vars["projectName"]
    Severity: Minor
    Found in controllers/testcases.go - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

              } else if (*historyUnit)[i].ChangeType == models.HistoryChangeTypeNote {
                  msg = fmt.Sprintf("%s added a note.", (*historyUnit)[i].What)
              } else {
                  msg = ""
              }
      Severity: Major
      Found in controllers/testcases.go - About 45 mins to fix

        Function UnlinkRequirementRelation has 6 return statements (exceeds 4 allowed).
        Open

        func UnlinkRequirementRelation(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request) error {
            // get requirement, testcase ID from post
            if err := r.ParseForm(); err != nil {
                log.Error("TestCase", "type", "app", "msg ", err.Error())
                return RenderJSONWithStatus(w, Resp{Msg: "Parse form is not valid"}, http.StatusBadRequest)
        Severity: Major
        Found in controllers/testcases.go - About 40 mins to fix

          Function handleSaveUpdate has 6 return statements (exceeds 4 allowed).
          Open

          func handleSaveUpdate(c *interfacer.AppContext, w http.ResponseWriter, r *http.Request, isUpdate bool) error {
          
              var testcase models.TestCase
              vars := mux.Vars(r)
              projectName := vars["projectName"]
          Severity: Major
          Found in controllers/testcases.go - About 40 mins to fix

            Your code does not pass gofmt in 1 place. Go fmt your code!
            Open

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

            There are no issues that match your filters.

            Category
            Status