puffer/puffer_pages

View on GitHub
app/assets/javascripts/puffer/codemirror.js

Summary

Maintainability
F
3 mos
Test Coverage

Function CodeMirror has a Cognitive Complexity of 2984 (exceeds 5 allowed). Consider refactoring.
Open

window.CodeMirror = (function() {
  "use strict";

  // BROWSER SNIFFING

Severity: Minor
Found in app/assets/javascripts/puffer/codemirror.js - About 2 mos 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 CodeMirror has 3916 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.CodeMirror = (function() {
  "use strict";

  // BROWSER SNIFFING

Severity: Major
Found in app/assets/javascripts/puffer/codemirror.js - About 2 wks to fix

    File codemirror.js has 3919 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // CodeMirror version 3.01
    //
    // CodeMirror is the only global var we claim
    window.CodeMirror = (function() {
      "use strict";
    Severity: Major
    Found in app/assets/javascripts/puffer/codemirror.js - About 1 wk to fix

      Function onMouseDown has 114 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function onMouseDown(e) {
          var cm = this, display = cm.display, view = cm.view, sel = view.sel, doc = view.doc;
          sel.shift = e_prop(e, "shiftKey");
      
          if (eventInWidget(display, e)) {
      Severity: Major
      Found in app/assets/javascripts/puffer/codemirror.js - About 4 hrs to fix

        Function updateDocNoUndo has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
            var view = cm.view, doc = view.doc, display = cm.display;
            if (view.suppressEdits) return;
        
            var nlines = to.line - from.line, firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
        Severity: Major
        Found in app/assets/javascripts/puffer/codemirror.js - About 4 hrs to fix

          Function bidiOrdering has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var bidiOrdering = (function() {
              // Character types for codepoints 0 to 0xff
              var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";
              // Character types for codepoints 0x600 to 0x6ff
              var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";
          Severity: Major
          Found in app/assets/javascripts/puffer/codemirror.js - About 3 hrs to fix

            Function updateDisplayInner has 81 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function updateDisplayInner(cm, changes, viewPort) {
                var display = cm.display, doc = cm.view.doc;
                if (!display.wrapper.clientWidth) {
                  display.showingFrom = display.showingTo = display.viewOffset = 0;
                  return;
            Severity: Major
            Found in app/assets/javascripts/puffer/codemirror.js - About 3 hrs to fix

              Function charOrdering has 78 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  return function charOrdering(str) {
                    if (!bidiRE.test(str)) return false;
                    var len = str.length, types = [];
                    for (var i = 0, type; i < len; ++i)
                      types.push(type = charType(str.charCodeAt(i)));
              Severity: Major
              Found in app/assets/javascripts/puffer/codemirror.js - About 3 hrs to fix

                Function registerEventHandlers has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function registerEventHandlers(cm) {
                    var d = cm.display;
                    on(d.scroller, "mousedown", operation(cm, onMouseDown));
                    on(d.scroller, "dblclick", operation(cm, e_preventDefault));
                    on(d.lineSpace, "selectstart", function(e) {
                Severity: Major
                Found in app/assets/javascripts/puffer/codemirror.js - About 2 hrs to fix

                  Function updateSelectionRange has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function updateSelectionRange(cm) {
                      var display = cm.display, doc = cm.view.doc, sel = cm.view.sel;
                      var fragment = document.createDocumentFragment();
                      var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
                  
                  
                  Severity: Major
                  Found in app/assets/javascripts/puffer/codemirror.js - About 2 hrs to fix

                    Function insertLineContent has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function insertLineContent(line, builder, styles) {
                        var spans = line.markedSpans;
                        if (!spans) {
                          for (var i = 1; i < styles.length; i+=2)
                            builder.addToken(builder, styles[i], styleToClass(styles[i+1]));
                    Severity: Major
                    Found in app/assets/javascripts/puffer/codemirror.js - About 2 hrs to fix

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

                        function onScrollWheel(cm, e) {
                          var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
                          if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
                          if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
                          else if (dy == null) dy = e.wheelDelta;
                      Severity: Minor
                      Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                        Function makeDisplay has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          function makeDisplay(place) {
                            var d = {};
                            var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
                            if (webkit) input.style.width = "1000px";
                            else input.setAttribute("wrap", "off");
                        Severity: Minor
                        Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                          Function patchDisplay has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
                              var dims = getDimensions(cm);
                              var display = cm.display, lineNumbers = cm.options.lineNumbers;
                              if (!intact.length && (!webkit || !cm.display.currentWheelTarget))
                                removeChildren(display.lineDiv);
                          Severity: Minor
                          Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                            Function markText has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function markText(cm, from, to, options, type) {
                                var doc = cm.view.doc;
                                var marker = new TextMarker(cm, type);
                                if (type == "range" && !posLess(from, to)) return marker;
                                if (options) for (var opt in options) if (options.hasOwnProperty(opt))
                            Severity: Minor
                            Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                              Function updateMarkedSpans has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function updateMarkedSpans(oldFirst, oldLast, startCh, endCh, newText) {
                                  if (!oldFirst && !oldLast) return newText;
                                  // Get the spans that 'stick out' on both sides
                                  var first = markedSpansBefore(oldFirst, startCh);
                                  var last = markedSpansAfter(oldLast, startCh, endCh);
                              Severity: Minor
                              Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                Function onDrop has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  function onDrop(e) {
                                    var cm = this;
                                    if (eventInWidget(cm.display, e) || (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))))
                                      return;
                                    e_preventDefault(e);
                                Severity: Minor
                                Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                  Function onContextMenu has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    function onContextMenu(cm, e) {
                                      var display = cm.display;
                                      if (eventInWidget(display, e)) return;
                                      
                                      var sel = cm.view.sel;
                                  Severity: Minor
                                  Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                    Function skipAtomic has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      function skipAtomic(cm, pos, bias, mayClear) {
                                        var doc = cm.view.doc, flipped = false, curPos = pos;
                                        var dir = bias || 1;
                                        cm.view.cantEdit = false;
                                        search: for (;;) {
                                    Severity: Minor
                                    Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

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

                                        CodeMirror.fromTextArea = function(textarea, options) {
                                          if (!options) options = {};
                                          options.value = textarea.value;
                                          if (!options.tabindex && textarea.tabindex)
                                            options.tabindex = textarea.tabindex;
                                      Severity: Minor
                                      Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                        Function measureLineInner has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          function measureLineInner(cm, line) {
                                            var display = cm.display, measure = emptyArray(line.text.length);
                                            var pre = lineContent(cm, line, measure);
                                        
                                            // IE does not cache element positions of inline elements between
                                        Severity: Minor
                                        Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                          Function buildLineElement has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                          Open

                                            function buildLineElement(cm, line, lineNo, dims) {
                                              var lineElement = lineContent(cm, line);
                                              var markers = line.gutterMarkers, display = cm.display;
                                          
                                              if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass &&
                                          Severity: Minor
                                          Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                            Function buildToken has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                            Open

                                              function buildToken(builder, text, style, startStyle, endStyle) {
                                                if (!text) return;
                                                if (!tokenSpecialChars.test(text)) {
                                                  builder.col += text.length;
                                                  var content = document.createTextNode(text);
                                            Severity: Minor
                                            Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                              Function addChange has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                function addChange(cm, start, added, old, origin, fromBefore, toBefore, fromAfter, toAfter) {
                                                  var history = cm.view.history;
                                                  history.undone.length = 0;
                                                  var time = +new Date, cur = lst(history.done);
                                                  
                                              Severity: Minor
                                              Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                Function highlightWorker has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                                Open

                                                  function highlightWorker(cm) {
                                                    var view = cm.view, doc = view.doc;
                                                    if (view.frontier >= cm.display.showingTo) return;
                                                    var end = +new Date + cm.options.workTime;
                                                    var state = copyState(view.mode, getStateBefore(cm, view.frontier));
                                                Severity: Minor
                                                Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

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

                                                    function moveVisually(line, start, dir, byUnit) {
                                                      var bidi = getOrder(line);
                                                      if (!bidi) return moveLogically(line, start, dir, byUnit);
                                                      var moveOneUnit = byUnit ? function(pos, dir) {
                                                        do pos += dir;
                                                  Severity: Minor
                                                  Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                    Function handleKeyBinding has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                      function handleKeyBinding(cm, e) {
                                                        // Handle auto keymap transitions
                                                        var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto;
                                                        clearTimeout(maybeTransition);
                                                        if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                      Function coordsCharInner has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                                      Open

                                                        function coordsCharInner(cm, lineObj, lineNo, x, y) {
                                                          var innerOff = y - heightAtLine(cm, lineObj);
                                                          var wrongLine = false, cWidth = cm.display.wrapper.clientWidth;
                                                          var measurement = measureLine(cm, lineObj);
                                                      
                                                      
                                                      Severity: Minor
                                                      Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                        Function clear has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                        Open

                                                          TextMarker.prototype.clear = function() {
                                                            if (this.explicitlyCleared) return;
                                                            startOperation(this.cm);
                                                            var view = this.cm.view, min = null, max = null;
                                                            for (var i = 0; i < this.lines.length; ++i) {
                                                        Severity: Minor
                                                        Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                          Function findPosH has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                          Open

                                                            function findPosH(cm, dir, unit, visually) {
                                                              var doc = cm.view.doc, end = cm.view.sel.head, line = end.line, ch = end.ch;
                                                              var lineObj = getLine(doc, line);
                                                              function findNextLine() {
                                                                var l = line + dir;
                                                          Severity: Minor
                                                          Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                            Function cursorCoords has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                                            Open

                                                              function cursorCoords(cm, pos, context, lineObj, measurement) {
                                                                lineObj = lineObj || getLine(cm.view.doc, pos.line);
                                                                if (!measurement) measurement = measureLine(cm, lineObj);
                                                                function get(ch, right) {
                                                                  var m = measureChar(cm, lineObj, ch, measurement);
                                                            Severity: Minor
                                                            Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                              Function lineContent has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                              Open

                                                                function lineContent(cm, realLine, measure) {
                                                                  var merged, line = realLine, lineBefore, sawBefore, simple = true;
                                                                  while (merged = collapsedSpanAtStart(line)) {
                                                                    simple = false;
                                                                    line = getLine(cm.view.doc, merged.find().from.line);
                                                              Severity: Minor
                                                              Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                                Function endOperation has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                Open

                                                                  function endOperation(cm) {
                                                                    var op = cm.curOp;
                                                                    if (--op.depth) return;
                                                                    cm.curOp = null;
                                                                    var view = cm.view, display = cm.display;
                                                                Severity: Minor
                                                                Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

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

                                                                    function indentLine(cm, n, how, aggressive) {
                                                                      var doc = cm.view.doc;
                                                                      if (!how) how = "add";
                                                                      if (how == "smart") {
                                                                        if (!cm.view.mode.indent) how = "prev";
                                                                  Severity: Minor
                                                                  Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                                    Function highlightLine has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                    Open

                                                                      function highlightLine(cm, line, state) {
                                                                        // A styles array always starts with a number identifying the
                                                                        // mode/overlays that it is based on (for easy invalidation).
                                                                        var st = [cm.view.modeGen];
                                                                        // Compute the base array of styles
                                                                    Severity: Minor
                                                                    Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                                      Function addChange has 9 arguments (exceeds 4 allowed). Consider refactoring.
                                                                      Open

                                                                        function addChange(cm, start, added, old, origin, fromBefore, toBefore, fromAfter, toAfter) {
                                                                      Severity: Major
                                                                      Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

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

                                                                          function CodeMirror(place, options) {
                                                                            if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
                                                                            
                                                                            this.options = options = options || {};
                                                                            // Determine effective options based on given values and defaults.
                                                                        Severity: Minor
                                                                        Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                                          Function addWidget has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                          Open

                                                                              addWidget: function(pos, node, scroll, vert, horiz) {
                                                                                var display = this.display;
                                                                                pos = cursorCoords(this, clipPos(this.view.doc, pos));
                                                                                var top = pos.top, left = pos.left;
                                                                                node.style.position = "absolute";
                                                                          Severity: Minor
                                                                          Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                                                                            Consider simplifying this complex logical expression.
                                                                            Open

                                                                                if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) &&
                                                                                    !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
                                                                                  var dragEnd = operation(cm, function(e2) {
                                                                                    if (webkit) display.scroller.draggable = false;
                                                                                    view.draggingText = false;
                                                                            Severity: Major
                                                                            Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

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

                                                                                function updateDoc(cm, from, to, newText, selUpdate, origin) {
                                                                              Severity: Minor
                                                                              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 (posEq(newPos, curPos)) {
                                                                                                newPos.ch += dir;
                                                                                                if (newPos.ch < 0) {
                                                                                                  if (newPos.line) newPos = clipPos(doc, {line: newPos.line - 1});
                                                                                                  else newPos = null;
                                                                                  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

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

                                                                                          Avoid deeply nested control flow statements.
                                                                                          Open

                                                                                                      if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
                                                                                          Severity: Major
                                                                                          Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                                                                                            Avoid deeply nested control flow statements.
                                                                                            Open

                                                                                                        if (mayClear && m.clearOnEnter) {
                                                                                                          (toClear || (toClear = [])).push(m);
                                                                                                          continue;
                                                                                                        } else if (!m.atomic) continue;
                                                                                            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 (widgets) for (var i = 0; i < widgets.length; ++i)
                                                                                                          widgets[i].height = widgets[i].node.offsetHeight;
                                                                                                Severity: Major
                                                                                                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

                                                                                                                  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

                                                                                                                      } 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

                                                                                                              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

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

                                                                                                                                    function updateMarkedSpans(oldFirst, oldLast, startCh, endCh, newText) {
                                                                                                                                  Severity: Minor
                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

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

                                                                                                                                      function coordsCharInner(cm, lineObj, lineNo, x, y) {
                                                                                                                                    Severity: Minor
                                                                                                                                    Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

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

                                                                                                                                        function calculateScrollPos(cm, x1, y1, x2, y2) {
                                                                                                                                      Severity: Minor
                                                                                                                                      Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

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

                                                                                                                                          function replaceRange(cm, code, from, to, origin) {
                                                                                                                                        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 addWidget has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                            Open

                                                                                                                                                addWidget: function(pos, node, scroll, vert, horiz) {
                                                                                                                                            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 scrollIntoView has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                                                                                                                                Open

                                                                                                                                                  function scrollIntoView(cm, x1, y1, x2, y2) {
                                                                                                                                                Severity: Minor
                                                                                                                                                Found in app/assets/javascripts/puffer/codemirror.js - About 35 mins to fix

                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                  Open

                                                                                                                                                          return lookup(fallthrough);
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                    Open

                                                                                                                                                        return true;
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                      Open

                                                                                                                                                            return;
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                        Open

                                                                                                                                                            if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                          Open

                                                                                                                                                              else return pos;
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                            Open

                                                                                                                                                                  return false;
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                              Open

                                                                                                                                                                      if (lookup(fallthrough[i])) return true;
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                Open

                                                                                                                                                                      else return "L";
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in app/assets/javascripts/puffer/codemirror.js - About 30 mins to fix

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                      display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
                                                                                                                                                                                                                        headPos.top + lineOff.top - wrapOff.top)) + "px";
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 694..695

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 73.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                      display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
                                                                                                                                                                                                                         headPos.left + lineOff.left - wrapOff.left)) + "px";
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 692..693

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 73.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
                                                                                                                                                                                   lastLine.text.slice(to.ch), hlSpans(lines[0]));
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2003..2004

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 67.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
                                                                                                                                                                                     firstLine.text.slice(to.ch), hlSpans(lines[0]));
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2013..2014

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 67.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                      for (var i = 0; i < chunk.lines.length; ++i) {
                                                                                                                                                                        var line = chunk.lines[i];
                                                                                                                                                                        if (line == lineObj) break;
                                                                                                                                                                        else h += line.height;
                                                                                                                                                                      }
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 4152..4156

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 67.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        for (var i = 0; i < p.children.length; ++i) {
                                                                                                                                                                          var cur = p.children[i];
                                                                                                                                                                          if (cur == chunk) break;
                                                                                                                                                                          else h += cur.height;
                                                                                                                                                                        }
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 4146..4150

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 67.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        for (var i = 1, e = lines.length - 1; i < e; ++i)
                                                                                                                                                                          added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 1996..1997

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 66.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        for (var i = 0, e = lines.length - 1; i < e; ++i)
                                                                                                                                                                          added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2020..2021

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 66.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        if (scrollPos.scrollTop != null) {
                                                                                                                                                                          setScrollTop(cm, scrollPos.scrollTop);
                                                                                                                                                                          if (Math.abs(cm.view.scrollTop - startTop) > 1) changed = true;
                                                                                                                                                                        }
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2243..2246

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 62.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        if (scrollPos.scrollLeft != null) {
                                                                                                                                                                          setScrollLeft(cm, scrollPos.scrollLeft);
                                                                                                                                                                          if (Math.abs(cm.view.scrollLeft - startLeft) > 1) changed = true;
                                                                                                                                                                        }
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2239..2242

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 62.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        if (this.display.scroller.scrollWidth > sLeft)
                                                                                                                                                                          this.display.scrollbarH.scrollLeft = this.display.scroller.scrollLeft = sLeft;
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2845..2846

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 55.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        if (this.display.scroller.scrollHeight > sTop)
                                                                                                                                                                          this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = sTop;
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2847..2848

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 55.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 45 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 1697..1697

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 50.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 45 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 1696..1696

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 50.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          if (posLess(p.from, m.from)) newParts.push({from: p.from, to: m.from});
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3529..3529

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 47.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                                (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2175..2175

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 47.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2018..2018

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 47.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                            if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2176..2176

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 47.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 2009..2009

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 47.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          if (posLess(m.to, p.to)) newParts.push({from: m.to, to: p.to});
                                                                                                                                                                  Severity: Minor
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3528..3528

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 47.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3436..3436
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3448..3448
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3450..3450

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 45.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3434..3434
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3436..3436
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3448..3448

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 45.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                        var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3434..3434
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3436..3436
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3450..3450

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 45.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  Similar blocks of code found in 4 locations. Consider refactoring.
                                                                                                                                                                  Open

                                                                                                                                                                          var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in app/assets/javascripts/puffer/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3434..3434
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3448..3448
                                                                                                                                                                  app/assets/javascripts/puffer/codemirror.js on lines 3450..3450

                                                                                                                                                                  Duplicated Code

                                                                                                                                                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                                                                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                                                                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                                                                                  Tuning

                                                                                                                                                                  This issue has a mass of 45.

                                                                                                                                                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                                                                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                                                                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                                                                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                                                                                  Refactorings

                                                                                                                                                                  Further Reading

                                                                                                                                                                  There are no issues that match your filters.

                                                                                                                                                                  Category
                                                                                                                                                                  Status