hunterlong/statup

View on GitHub

Showing 284 of 423 total issues

Function CodeMirror has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function CodeMirror(place, options) {
  var this$1 = this;

  if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }

Severity: Major
Found in frontend/public/js/codemirror.js - About 2 hrs to fix

    Function tokenBase has 50 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function tokenBase(stream, state) {
        var ch = stream.next();
        if (tokenHooks[ch]) {
          var result = tokenHooks[ch](stream, state);
          if (result !== false) return result;
    Severity: Minor
    Found in frontend/public/js/css.js - About 2 hrs to fix

      Function tokenBase has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function tokenBase(stream, state) {
          var ch = stream.next();
          if (tokenHooks[ch]) {
            var result = tokenHooks[ch](stream, state);
            if (result !== false) return result;
      Severity: Minor
      Found in frontend/src/assets/js/css.js - About 2 hrs to fix

        Function Display has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Display(place, doc, input) {
          var d = this
          this.input = input
        
          // Covers bottom-right square when both scrollbars are present.
        Severity: Minor
        Found in frontend/public/js/codemirror.js - About 2 hrs to fix

          Consider simplifying this complex logical expression.
          Open

                } else if (stream.match(".Id") || stream.match(".Domain") || stream.match(".CreatedAt") ||
                  stream.match(".Name") || stream.match(".Downtime.Human") || stream.match(".Issue") || stream.match(".LastStatusCode") ||
                  stream.match(".Port") || stream.match(".FailuresLast24Hours") || stream.match(".PingTime")) {
                  return "var-sub-highlight"
                } else if (stream.match("{{") || stream.match("}}")) {
          Severity: Critical
          Found in frontend/src/codemirror_json.js - About 2 hrs to fix

            Function moveVisually has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function moveVisually(cm, line, start, dir) {
              var bidi = getOrder(line, cm.doc.direction)
              if (!bidi) { return moveLogically(line, start, dir) }
              if (start.ch >= line.text.length) {
                start.ch = line.text.length
            Severity: Minor
            Found in frontend/public/js/codemirror.js - About 2 hrs to fix

              Function onScrollWheel has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function onScrollWheel(cm, e) {
                var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
              
                var display = cm.display, scroll = display.scroller
                // Quit if there's nothing to scroll here
              Severity: Minor
              Found in frontend/public/js/codemirror.js - About 2 hrs to fix

                Function Samples has 73 lines of code (exceeds 50 allowed). Consider refactoring.
                Open

                func Samples() error {
                    log.Infoln("Inserting Sample Incidents...")
                    incident1 := &Incident{
                        Title:       "Github Issues",
                        Description: "There are new features for Statping, if you have any issues please visit the Github Repo.",
                Severity: Minor
                Found in types/incidents/samples.go - About 1 hr to fix

                  Function drawForLine has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function drawForLine(line, fromArg, toArg) {
                      var lineObj = getLine(doc, line)
                      var lineLen = lineObj.text.length
                      var start, end
                      function coords(ch, bias) {
                  Severity: Minor
                  Found in frontend/public/js/codemirror.js - About 1 hr to fix

                    Function updateDisplayIfNeeded has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function updateDisplayIfNeeded(cm, update) {
                      var display = cm.display, doc = cm.doc
                    
                      if (update.editorIsHidden) {
                        resetView(cm)
                    Severity: Minor
                    Found in frontend/public/js/codemirror.js - About 1 hr to fix

                      Function domTextBetween has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function domTextBetween(cm, from, to, fromLine, toLine) {
                        var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false
                        function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
                        function close() {
                          if (closing) {
                      Severity: Minor
                      Found in frontend/public/js/codemirror.js - About 1 hr to fix

                        Function locateNodeInLineView has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function locateNodeInLineView(lineView, node, offset) {
                          var wrapper = lineView.text.firstChild, bad = false
                          if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
                          if (node == wrapper) {
                            bad = true
                        Severity: Minor
                        Found in frontend/public/js/codemirror.js - About 1 hr to fix

                          Function indentLine has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function indentLine(cm, n, how, aggressive) {
                            var doc = cm.doc, state
                            if (how == null) { how = "add" }
                            if (how == "smart") {
                              // Fall back to "prev" when the mode doesn't have an indentation
                          Severity: Minor
                          Found in frontend/public/js/codemirror.js - About 1 hr to fix

                            Function stretchSpansOverChange has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            function stretchSpansOverChange(doc, change) {
                              if (change.full) { return null }
                              var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
                              var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
                              if (!oldFirst && !oldLast) { return null }
                            Severity: Minor
                            Found in frontend/public/js/codemirror.js - About 1 hr to fix

                              Function InitEnvs has 72 lines of code (exceeds 50 allowed). Consider refactoring.
                              Open

                              func InitEnvs() {
                                  if Params != nil {
                                      return
                                  }
                                  Params = viper.New()
                              Severity: Minor
                              Found in utils/env.go - About 1 hr to fix

                                Function makeChangeSingleDocInEditor has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function makeChangeSingleDocInEditor(cm, change, spans) {
                                  var doc = cm.doc, display = cm.display, from = change.from, to = change.to
                                
                                  var recomputeMaxLength = false, checkWidthStart = from.line
                                  if (!cm.options.lineWrapping) {
                                Severity: Minor
                                Found in frontend/public/js/codemirror.js - About 1 hr to fix

                                  Function fromTextArea has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function fromTextArea(textarea, options) {
                                    options = options ? copyObj(options) : {}
                                    options.value = textarea.value
                                    if (!options.tabindex && textarea.tabIndex)
                                      { options.tabindex = textarea.tabIndex }
                                  Severity: Minor
                                  Found in frontend/public/js/codemirror.js - About 1 hr to fix

                                    Function measureCharInner has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function measureCharInner(cm, prepared, ch, bias) {
                                      var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
                                      var node = place.node, start = place.start, end = place.end, collapse = place.collapse
                                    
                                      var rect
                                    Severity: Minor
                                    Found in frontend/public/js/codemirror.js - About 1 hr to fix

                                      Function CheckHttp has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      func CheckHttp(s *Service, record bool) (*Service, error) {
                                          defer s.updateLastCheck()
                                          timer := prometheus.NewTimer(metrics.ServiceTimer(s.Name))
                                          defer timer.ObserveDuration()
                                      
                                      
                                      Severity: Minor
                                      Found in types/services/routine.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 settingsImportHandler has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
                                      Open

                                      func settingsImportHandler(w http.ResponseWriter, r *http.Request) {
                                          data, err := ioutil.ReadAll(r.Body)
                                          if err != nil {
                                              sendErrorJson(err, w, r)
                                              return
                                      Severity: Minor
                                      Found in handlers/dashboard.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language