api/handlers/endpoints.go
Function ApiAttempt
has a Cognitive Complexity of 59 (exceeds 20 allowed). Consider refactoring. Open
Open
func ApiAttempt(w http.ResponseWriter, r *http.Request) (callmet bool) {
var response string
var session *sessions.Session
var er error
- Read upRead up
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 ApiAttempt
has 78 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func ApiAttempt(w http.ResponseWriter, r *http.Request) (callmet bool) {
var response string
var session *sessions.Session
var er error
Avoid deeply nested control flow statements. Open
Open
} else if isURL := (r.URL.Path == "/api/govet" && r.Method == strings.ToUpper("POST")); !callmet && isURL {
response, callmet = POSTApiGovet(w, r, session)
} else if !callmet && gosweb.UrlAtZ(r.URL.Path, "/api/socket") {
package comment should be of the form "Package handlers ..." Open
Open
// File generated by Gopher Sauce
- Exclude checks
exported function ApiAttempt should have comment or be unexported Open
Open
func ApiAttempt(w http.ResponseWriter, r *http.Request) (callmet bool) {
- Exclude checks
exported var WebCache should have comment or be unexported Open
Open
var WebCache = gosweb.NewCache()
- Exclude checks
func ApiAttempt should be APIAttempt Open
Open
func ApiAttempt(w http.ResponseWriter, r *http.Request) (callmet bool) {
- Exclude checks