puffer/puffer_pages

View on GitHub

Showing 177 of 219 total issues

Avoid deeply nested control flow statements.
Open

          } else if (sp.from > pos && nextChange > sp.from) {
            nextChange = sp.from;
          }
Severity: Major
Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                  if (pos < j) order.splice(at, 0, {from: pos, to: j, level: 1});
    Severity: Major
    Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                  if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; }
      Severity: Major
      Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (atMediaTypes[stream.current()]) {
                    style = "attribute"; // Known attribute
                  } else if (/^(only|not)$/i.test(stream.current())) {
                    style = "keyword";
                  } else if (stream.current().toLowerCase() == "and") {
        Severity: Major
        Found in app/assets/javascripts/puffer/codemirror/css.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                      if (sameLine) (first || (first = [])).push(span);
          Severity: Major
          Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

            Function updateDocNoUndo has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
            Severity: Minor
            Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (prev.nodeType == "pre") {
                            var wrap = elt("div", null, null, "position: relative");
                            prev.parentNode.replaceChild(wrap, prev);
                            wrap.appendChild(prev);
                            prev = wrap;
              Severity: Major
              Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            if (m.className) spanStyle += " " + m.className;
                Severity: Major
                Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                  Method import_json has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def import_json json
                              data = json.is_a?(String) ? ActiveSupport::JSON.decode(json) : json.map(&:stringify_keys!)
                  
                              import_destroy
                  
                  
                  Severity: Minor
                  Found in lib/puffer_pages/backends/models/mixins/importable.rb - About 45 mins 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

                  Method resolve_with_interpolation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def resolve_with_interpolation key
                            if key.is_a? Symbol
                              scope = @scopes.detect { |s| s.key? key }
                              scope ||= @environments.detect { |s| s.key? key }
                              scope[key] if scope
                  Severity: Minor
                  Found in lib/puffer_pages/extensions/context.rb - About 45 mins 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

                  Consider simplifying this complex logical expression.
                  Open

                        if (display.wheelStartX == null) {
                          display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
                          display.wheelDX = dx; display.wheelDY = dy;
                          setTimeout(function() {
                            if (display.wheelStartX == null) return;
                  Severity: Major
                  Found in app/assets/javascripts/puffer/codemirror.js - About 40 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                          if (endsAfter || marker.type == "bookmark" && span.from == endCh && span.from != startCh) {
                            var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
                            (nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh,
                                                    to: span.to == null ? null : span.to - endCh,
                                                    marker: marker});
                    Severity: Major
                    Found in app/assets/javascripts/puffer/codemirror.js - About 40 mins to fix

                      Consider simplifying this complex logical expression.
                      Open

                            if ((sp.from == null || sp.from < ch) &&
                                (sp.to == null || sp.to > ch) &&
                                (!found || found.width < sp.marker.width))
                              found = sp.marker;
                      Severity: Major
                      Found in app/assets/javascripts/puffer/codemirror.js - About 40 mins to fix

                        Consider simplifying this complex logical expression.
                        Open

                            if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass &&
                                (!line.widgets || !line.widgets.length)) return lineElement;
                        Severity: Major
                        Found in app/assets/javascripts/puffer/codemirror.js - About 40 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if (cur &&
                                  (history.lastOp == cm.curOp.id ||
                                   history.lastOrigin == origin && (origin == "input" || origin == "delete") &&
                                   history.lastTime > time - 600)) {
                                // Merge this change into the last event
                          Severity: Major
                          Found in app/assets/javascripts/puffer/codemirror.js - About 40 mins to fix

                            Function parseJS has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                              function parseJS(state, style, type, content, stream) {
                            Severity: Minor
                            Found in app/assets/javascripts/puffer/codemirror/javascript.js - About 35 mins to fix

                              Function setSelection has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                function setSelection(cm, anchor, head, bias, checkAtomic) {
                              Severity: Minor
                              Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

                                Function buildToken has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  function buildToken(builder, text, style, startStyle, endStyle) {
                                Severity: Minor
                                Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

                                  Function cursorCoords has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    function cursorCoords(cm, pos, context, lineObj, measurement) {
                                  Severity: Minor
                                  Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

                                    Function runMode has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                      function runMode(cm, text, mode, state, f) {
                                    Severity: Minor
                                    Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language