thestrukture/IDE

View on GitHub
api/handlers/rest_POSTApiCreate.go

Summary

Maintainability
A
1 hr
Test Coverage
F
24%

Function POSTApiCreate has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func POSTApiCreate(w http.ResponseWriter, r *http.Request, session *sessions.Session) (response string, callmet bool) {

    //me := &types.SoftUser{Email:"Strukture user", Username:"Strukture user"}

    if r.FormValue("type") == "0" {
Severity: Minor
Found in api/handlers/rest_POSTApiCreate.go - About 1 hr to fix

    Avoid deeply nested control flow statements.
    Open

        } else if r.FormValue("type") == "4" {
            varf := []types.Inputs{}
            varf = append(varf, types.Inputs{Name: "name", Type: "text", Text: "Template name"})
    
            response = templates.Form(types.Forms{Link: "/api/act?type=5&pkg=" + r.FormValue("pkg") + "&bundle=" + r.FormValue("bundle"), CTA: "Create Template file", Class: "warning", Inputs: varf})
    Severity: Major
    Found in api/handlers/rest_POSTApiCreate.go - About 45 mins to fix

      package comment should be of the form "Package handlers ..."
      Open

      // File generated by Gopher Sauce
      Severity: Minor
      Found in api/handlers/rest_POSTApiCreate.go by golint

      comment on exported function POSTApiCreate should be of the form "POSTApiCreate ..."
      Open

      //
      Severity: Minor
      Found in api/handlers/rest_POSTApiCreate.go by golint

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

      // File generated by Gopher Sauce
      Severity: Minor
      Found in api/handlers/rest_POSTApiCreate.go by gofmt

      There are no issues that match your filters.

      Category
      Status