puffer/puffer_pages

View on GitHub

Showing 177 of 219 total issues

Avoid deeply nested control flow statements.
Open

              for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
Severity: Major
Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

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

      function updateDocInner(cm, from, to, newText, 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 (m.collapsed && (!collapsed || collapsed.marker.width < m.width))
                    collapsed = sp;
      Severity: Major
      Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
        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

                    } else if (context == "@mediaType") {
                      if (atMediaTypes[stream.current()]) {
                        style = "attribute";
                      } else if (stream.current().toLowerCase() == "and") {
                        style = "operator";
            Severity: Major
            Found in app/assets/javascripts/puffer/codemirror/css.js - About 45 mins to fix

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

                function JSLexical(indented, column, type, align, prev, info) {
              Severity: Minor
              Found in app/assets/javascripts/puffer/codemirror/javascript.js - About 45 mins to fix

                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

                  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 (!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 (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 (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

                          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

                            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 markText has 5 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                function markText(cm, from, to, options, type) {
                              Severity: Minor
                              Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

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

                                  function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
                                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

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

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