Roverr/rtsp-stream

View on GitHub

Showing 4 of 6 total issues

Method Controller.StartStreamHandler has 65 lines of code (exceeds 50 allowed). Consider refactoring.
Open

func (c *Controller) StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
    if !c.isAuthenticated(r, "start") {
        w.WriteHeader(http.StatusForbidden)
        return
    }
Severity: Minor
Found in core/controller.go - About 1 hr to fix

    Method Controller.isAuthenticated has 11 return statements (exceeds 4 allowed).
    Open

    func (c *Controller) isAuthenticated(r *http.Request, endpoint string) bool {
        if !c.spec.JWTEnabled {
            return true
        }
        token, claims := c.jwt.Validate(r.Header.Get("Authorization"))
    Severity: Major
    Found in core/controller.go - About 1 hr to fix

      Method Controller.StartStreamHandler has 6 return statements (exceeds 4 allowed).
      Open

      func (c *Controller) StartStreamHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
          if !c.isAuthenticated(r, "start") {
              w.WriteHeader(http.StatusForbidden)
              return
          }
      Severity: Major
      Found in core/controller.go - About 40 mins to fix

        Method Controller.StopStreamHandler has 5 return statements (exceeds 4 allowed).
        Open

        func (c *Controller) StopStreamHandler(w http.ResponseWriter, r *http.Request, p httprouter.Params) {
            if !c.isAuthenticated(r, "stop") {
                w.WriteHeader(http.StatusForbidden)
                return
            }
        Severity: Major
        Found in core/controller.go - About 35 mins to fix
          Severity
          Category
          Status
          Source
          Language