jbox-web/redmine_bootstrap_kit

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

Summary

Maintainability
F
4 mos
Test Coverage

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

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

  // BROWSER SNIFFING

Severity: Minor
Found in assets/javascripts/codemirror/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 4955 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

  // BROWSER SNIFFING

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

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

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

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

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

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

          function registerEventHandlers(cm) {
            var d = cm.display;
            on(d.scroller, "mousedown", operation(cm, onMouseDown));
            if (ie)
              on(d.scroller, "dblclick", operation(cm, function(e) {
        Severity: Major
        Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 3 hrs to fix

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

              function updateDisplayInner(cm, changes, visible, forced) {
                var display = cm.display, doc = cm.doc;
                if (!display.wrapper.clientWidth) {
                  display.showingFrom = display.showingTo = doc.first;
                  display.viewOffset = 0;
            Severity: Major
            Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

                function buildLineElement(cm, line, lineNo, dims, reuse) {
                  var built = buildLineContent(cm, line), lineElement = built.pre;
                  var markers = line.gutterMarkers, display = cm.display, wrap;
              
                  var bgClass = built.bgClass ? built.bgClass + " " + (line.bgClass || "") : line.bgClass;
              Severity: Major
              Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

                  function measureLineInner(cm, line) {
                    if (!cm.options.lineWrapping && line.text.length >= cm.options.crudeMeasuringFrom)
                      return crudelyMeasureLine(cm, line);
                
                    var display = cm.display, measure = emptyArray(line.text.length);
                Severity: Major
                Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

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

                    Function patchDisplay has 55 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: Major
                    Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

                        function markText(doc, from, to, options, type) {
                          if (options && options.shared) return markTextShared(doc, from, to, options, type);
                          if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type);
                      
                          var marker = new TextMarker(doc, type);
                      Severity: Major
                      Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

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

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

                            function endOperation(cm) {
                              var op = cm.curOp, doc = cm.doc, display = cm.display;
                              cm.curOp = null;
                          
                              if (op.updateMaxLine) computeMaxLength(cm);
                          Severity: Major
                          Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

                              function onContextMenu(cm, e) {
                                if (signalDOMEvent(cm, e, "contextmenu")) return;
                                var display = cm.display, sel = cm.doc.sel;
                                if (eventInWidget(display, e) || contextMenuInGutter(cm, e)) return;
                            
                            
                            Severity: Major
                            Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

                                function stretchSpansOverChange(doc, change) {
                                  var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
                                  var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
                                  if (!oldFirst && !oldLast) return null;
                              
                              
                              Severity: Major
                              Found in assets/javascripts/codemirror/codemirror.js - About 2 hrs to fix

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

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

                                  Function onScrollWheel has 49 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 assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                    Function fromTextArea has 44 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 assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

                                        Consider simplifying this complex logical expression.
                                        Open

                                              if (startsBefore ||
                                                  (marker.inclusiveLeft && marker.inclusiveRight || marker.type == "bookmark") &&
                                                  span.from == startCh && (!isInsert || !span.marker.insertLeft)) {
                                                var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
                                                (nw || (nw = [])).push({from: span.from,
                                        Severity: Critical
                                        Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

                                            function findPosH(doc, pos, dir, unit, visually) {
                                              var line = pos.line, ch = pos.ch, origDir = dir;
                                              var lineObj = getLine(doc, line);
                                              var possible = true;
                                              function findNextLine() {
                                          Severity: Minor
                                          Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

                                              Function buildLineContent has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                                              Open

                                                function buildLineContent(cm, realLine, measure, copyWidgets) {
                                                  var merged, line = realLine, empty = true;
                                                  while (merged = collapsedSpanAtStart(line))
                                                    line = getLine(cm.doc, merged.find().from.line);
                                              
                                              
                                              Severity: Minor
                                              Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

                                                  Function updateScrollbars has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                  Open

                                                    function updateScrollbars(cm) {
                                                      var d = cm.display, docHeight = cm.doc.height;
                                                      var totalHeight = docHeight + paddingVert(d);
                                                      d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px";
                                                      d.gutters.style.height = Math.max(totalHeight, d.scroller.clientHeight - scrollerCutOff) + "px";
                                                  Severity: Minor
                                                  Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                    Function updateDoc has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                                    Open

                                                      function updateDoc(doc, change, markedSpans, selAfter, estimateHeight) {
                                                        function spansFor(n) {return markedSpans ? markedSpans[n] : null;}
                                                        function update(line, text, spans) {
                                                          updateLine(line, text, spans, estimateHeight);
                                                          signalLater(line, "change", line, change);
                                                    Severity: Minor
                                                    Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

                                                        function buildToken(builder, text, style, startStyle, endStyle, title) {
                                                          if (!text) return;
                                                          var special = builder.cm.options.specialChars;
                                                          if (!special.test(text)) {
                                                            builder.col += text.length;
                                                      Severity: Minor
                                                      Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

                                                          Function coordsCharInner has 34 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, adjust = 2 * cm.display.wrapper.clientWidth;
                                                              var measurement = measureLine(cm, lineObj);
                                                          
                                                          
                                                          Severity: Minor
                                                          Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

                                                              TextMarker.prototype.clear = function() {
                                                                if (this.explicitlyCleared) return;
                                                                var cm = this.doc.cm, withOp = cm && !cm.curOp;
                                                                if (withOp) startOperation(cm);
                                                                if (hasHandler(this, "clear")) {
                                                            Severity: Minor
                                                            Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                              Function CodeMirror has 34 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 assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                Consider simplifying this complex logical expression.
                                                                Open

                                                                    if (cur &&
                                                                        (hist.lastOp == opId ||
                                                                         hist.lastOrigin == change.origin && change.origin &&
                                                                         ((change.origin.charAt(0) == "+" && doc.cm && hist.lastTime > time - doc.cm.options.historyEventDelay) ||
                                                                          change.origin.charAt(0) == "*"))) {
                                                                Severity: Critical
                                                                Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

                                                                    function readInput(cm) {
                                                                      var input = cm.display.input, prevInput = cm.display.prevInput, doc = cm.doc, sel = doc.sel;
                                                                      if (!cm.state.focused || hasSelection(input) || isReadOnly(cm) || cm.state.disableInput) return false;
                                                                      if (cm.state.pasteIncoming && cm.state.fakedLastChar) {
                                                                        input.value = input.value.substring(0, input.value.length - 1);
                                                                  Severity: Minor
                                                                  Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

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

                                                                        function highlightWorker(cm) {
                                                                          var doc = cm.doc;
                                                                          if (doc.frontier < doc.first) doc.frontier = doc.first;
                                                                          if (doc.frontier >= cm.display.showingTo) return;
                                                                          var end = +new Date + cm.options.workTime;
                                                                      Severity: Minor
                                                                      Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

                                                                          function makeChangeFromHistory(doc, type) {
                                                                            if (doc.cm && doc.cm.state.suppressEdits) return;
                                                                        
                                                                            var hist = doc.history;
                                                                            var event = (type == "undo" ? hist.done : hist.undone).pop();
                                                                        Severity: Minor
                                                                        Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                          Function addWidget has 29 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.doc, pos));
                                                                                var top = pos.bottom, left = pos.left;
                                                                                node.style.position = "absolute";
                                                                          Severity: Minor
                                                                          Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

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

                                                                                function addToHistory(doc, change, selAfter, opId) {
                                                                                  var hist = doc.history;
                                                                                  hist.undone.length = 0;
                                                                                  var time = +new Date, cur = lst(hist.done);
                                                                              
                                                                              
                                                                              Severity: Minor
                                                                              Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                                Function updateDisplay has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                                                                Open

                                                                                  function updateDisplay(cm, changes, viewPort, forced) {
                                                                                    var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo, updated;
                                                                                    var visible = visibleLines(cm.display, cm.doc, viewPort);
                                                                                    for (var first = true;; first = false) {
                                                                                      var oldWidth = cm.display.scroller.clientWidth;
                                                                                Severity: Minor
                                                                                Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                                  Function handleKeyBinding has 27 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 assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

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

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

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

                                                                                        function rebaseHistArray(array, from, to, diff) {
                                                                                          for (var i = 0; i < array.length; ++i) {
                                                                                            var sub = array[i], ok = true;
                                                                                            for (var j = 0; j < sub.changes.length; ++j) {
                                                                                              var cur = sub.changes[j];
                                                                                      Severity: Minor
                                                                                      Found in assets/javascripts/codemirror/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;
                                                                                                cm.state.draggingText = false;
                                                                                        Severity: Major
                                                                                        Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                                          Consider simplifying this complex logical expression.
                                                                                          Open

                                                                                                if (ie && wrapping && ch == " " && i && !/\s/.test(text.charAt(i - 1)) &&
                                                                                                    i < text.length - 1 && !/\s/.test(text.charAt(i + 1)))
                                                                                                  span.style.whiteSpace = "normal";
                                                                                          Severity: Major
                                                                                          Found in assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                                            Consider simplifying this complex logical expression.
                                                                                            Open

                                                                                                  if (endsAfter || marker.type == "bookmark" && span.from == endCh && (!isInsert || span.marker.insertLeft)) {
                                                                                                    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 assets/javascripts/codemirror/codemirror.js - About 1 hr to fix

                                                                                              Avoid deeply nested control flow statements.
                                                                                              Open

                                                                                                          if (widget.node == n.firstChild) {
                                                                                                            if (!widget.above && !insertBefore) insertBefore = n;
                                                                                                            positionLineWidget(widget, n, reuse, dims);
                                                                                                            ++widgetsSeen;
                                                                                                            break;
                                                                                              Severity: Major
                                                                                              Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                  Avoid deeply nested control flow statements.
                                                                                                  Open

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

                                                                                                    Avoid deeply nested control flow statements.
                                                                                                    Open

                                                                                                                if (m.collapsed && (!collapsed || collapsed.marker.size < m.size))
                                                                                                                  collapsed = sp;
                                                                                                    Severity: Major
                                                                                                    Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

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

                                                                                                        function runMode(cm, text, mode, state, f, forceToEnd) {
                                                                                                      Severity: Minor
                                                                                                      Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                        Avoid deeply nested control flow statements.
                                                                                                        Open

                                                                                                                    if (!w.handleMouseEvents) wnode.ignoreEvents = true;
                                                                                                        Severity: Major
                                                                                                        Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                          Avoid deeply nested control flow statements.
                                                                                                          Open

                                                                                                                      if (oldCur[k].marker == span.marker) continue spans;
                                                                                                          Severity: Major
                                                                                                          Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                            Avoid deeply nested control flow statements.
                                                                                                            Open

                                                                                                                      if (search.lineObj == line && /div/i.test(search.nodeName)) { reuse = search; break; }
                                                                                                            Severity: Major
                                                                                                            Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                Open

                                                                                                                            if (!m.atomic) continue;
                                                                                                                Severity: Major
                                                                                                                Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                  Open

                                                                                                                              if (sameLine) (first || (first = [])).push(span);
                                                                                                                  Severity: Major
                                                                                                                  Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/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 assets/javascripts/codemirror/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 > doc.first) newPos = clipPos(doc, Pos(newPos.line - 1));
                                                                                                                                        else newPos = null;
                                                                                                                        Severity: Major
                                                                                                                        Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                                          Avoid deeply nested control flow statements.
                                                                                                                          Open

                                                                                                                                      if (mayClear) {
                                                                                                                                        signal(m, "beforeCursorEnter");
                                                                                                                                        if (m.explicitlyCleared) {
                                                                                                                                          if (!line.markedSpans) break;
                                                                                                                                          else {--i; continue;}
                                                                                                                          Severity: Major
                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

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

                                                                                                                              function buildToken(builder, text, style, startStyle, endStyle, title) {
                                                                                                                            Severity: Minor
                                                                                                                            Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                                                Avoid deeply nested control flow statements.
                                                                                                                                Open

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

                                                                                                                                  Avoid deeply nested control flow statements.
                                                                                                                                  Open

                                                                                                                                              if (m.title && !title) title = m.title;
                                                                                                                                  Severity: Major
                                                                                                                                  Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 45 mins to fix

                                                                                                                                      Avoid deeply nested control flow statements.
                                                                                                                                      Open

                                                                                                                                              if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
                                                                                                                                                if (indexOf(newGroup, Number(m[1])) > -1) {
                                                                                                                                                  lst(newChanges)[prop] = change[prop];
                                                                                                                                                  delete change[prop];
                                                                                                                                                }
                                                                                                                                      Severity: Major
                                                                                                                                      Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 40 mins to fix

                                                                                                                                            Consider simplifying this complex logical expression.
                                                                                                                                            Open

                                                                                                                                                  if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
                                                                                                                                                      target == display.scrollbarV || target == display.scrollbarV.firstChild ||
                                                                                                                                                      target == display.scrollbarFiller || target == display.gutterFiller) return null;
                                                                                                                                            Severity: Major
                                                                                                                                            Found in assets/javascripts/codemirror/codemirror.js - About 40 mins to fix

                                                                                                                                              Consider simplifying this complex logical expression.
                                                                                                                                              Open

                                                                                                                                                    if (sp.marker.collapsed && !sp.marker.replacedWith && sp.from == span.to &&
                                                                                                                                                        (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
                                                                                                                                                        lineIsHiddenInner(doc, line, sp)) return true;
                                                                                                                                              Severity: Major
                                                                                                                                              Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 40 mins to fix

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

                                                                                                                                                    function gutterEvent(cm, e, type, prevent, signalfn) {
                                                                                                                                                  Severity: Minor
                                                                                                                                                  Found in assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                      function updateDoc(doc, change, markedSpans, selAfter, estimateHeight) {
                                                                                                                                                    Severity: Minor
                                                                                                                                                    Found in assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                        function charCoords(cm, pos, context, lineObj, bias) {
                                                                                                                                                      Severity: Minor
                                                                                                                                                      Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                            function findPosH(doc, pos, dir, unit, visually) {
                                                                                                                                                          Severity: Minor
                                                                                                                                                          Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                                function buildLineElement(cm, line, lineNo, dims, reuse) {
                                                                                                                                                              Severity: Minor
                                                                                                                                                              Found in assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                                  function measureChar(cm, line, ch, data, bias) {
                                                                                                                                                                Severity: Minor
                                                                                                                                                                Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                                      function replaceRange(doc, code, from, to, origin) {
                                                                                                                                                                    Severity: Minor
                                                                                                                                                                    Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

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

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

                                                                                                                                                                            function countColumn(string, end, tabSize, startIndex, startValue) {
                                                                                                                                                                          Severity: Minor
                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

                                                                                                                                                                              function markTextShared(doc, from, to, options, type) {
                                                                                                                                                                            Severity: Minor
                                                                                                                                                                            Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/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 assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 35 mins to fix

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

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

                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                      Open

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

                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                        Open

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

                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                          Open

                                                                                                                                                                                              return {anchor: adjustPos(doc.sel.anchor), head: adjustPos(doc.sel.head)};
                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                            Open

                                                                                                                                                                                                  return;
                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                            Found in assets/javascripts/codemirror/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 assets/javascripts/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                Open

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

                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                        return clipToLen(pos, change.text[inside].length + (inside ? 0 : change.from.ch));
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in assets/javascripts/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                      Open

                                                                                                                                                                                                              if (!part) return null;
                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                      Found in assets/javascripts/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                        Open

                                                                                                                                                                                                                if (done) return done;
                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                        Found in assets/javascripts/codemirror/codemirror.js - About 30 mins to fix

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

                                                                                                                                                                                                              match: function(pattern, consume, caseInsensitive) {
                                                                                                                                                                                                                if (typeof pattern == "string") {
                                                                                                                                                                                                                  var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
                                                                                                                                                                                                                  var substr = this.string.substr(this.pos, pattern.length);
                                                                                                                                                                                                                  if (cased(substr) == cased(pattern)) {
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 day to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/runmode/runmode-standalone.js on lines 46..60

                                                                                                                                                                                                          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 216.

                                                                                                                                                                                                          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

                                                                                                                                                                                                              eat: function(match) {
                                                                                                                                                                                                                var ch = this.string.charAt(this.pos);
                                                                                                                                                                                                                if (typeof match == "string") var ok = ch == match;
                                                                                                                                                                                                                else var ok = ch && (match.test ? match.test(ch) : match(ch));
                                                                                                                                                                                                                if (ok) {++this.pos; return ch;}
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/runmode/runmode-standalone.js on lines 22..27

                                                                                                                                                                                                          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 108.

                                                                                                                                                                                                          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

                                                                                                                                                                                                              linkedDocs(doc, function(doc, sharedHist) {
                                                                                                                                                                                                                if (!sharedHist && indexOf(rebased, doc.history) == -1) {
                                                                                                                                                                                                                  rebaseHist(doc.history, change);
                                                                                                                                                                                                                  rebased.push(doc.history);
                                                                                                                                                                                                                }
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2394..2400

                                                                                                                                                                                                          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 85.

                                                                                                                                                                                                          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

                                                                                                                                                                                                                linkedDocs(doc, function(doc, sharedHist) {
                                                                                                                                                                                                                  if (!sharedHist && indexOf(rebased, doc.history) == -1) {
                                                                                                                                                                                                                    rebaseHist(doc.history, change);
                                                                                                                                                                                                                    rebased.push(doc.history);
                                                                                                                                                                                                                  }
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2355..2361

                                                                                                                                                                                                          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 85.

                                                                                                                                                                                                          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

                                                                                                                                                                                                            function indexOf(collection, elt) {
                                                                                                                                                                                                              if (collection.indexOf) return collection.indexOf(elt);
                                                                                                                                                                                                              for (var i = 0, e = collection.length; i < e; ++i)
                                                                                                                                                                                                                if (collection[i] == elt) return i;
                                                                                                                                                                                                              return -1;
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/edit/closetag.js on lines 83..88

                                                                                                                                                                                                          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 78.

                                                                                                                                                                                                          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) || !mk.inclusiveRight && posEq(p.to, m.to))
                                                                                                                                                                                                                    newParts.push({from: m.to, to: p.to});
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4120..4121

                                                                                                                                                                                                          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 74.

                                                                                                                                                                                                          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) || !mk.inclusiveLeft && posEq(p.from, m.from))
                                                                                                                                                                                                                    newParts.push({from: p.from, to: m.from});
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4122..4123

                                                                                                                                                                                                          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 74.

                                                                                                                                                                                                          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.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
                                                                                                                                                                                                                                                                  headPos.top + lineOff.top - wrapOff.top)) + "px";
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 792..793

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 790..791

                                                                                                                                                                                                          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

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

                                                                                                                                                                                                              eatSpace: function() {
                                                                                                                                                                                                                var start = this.pos;
                                                                                                                                                                                                                while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
                                                                                                                                                                                                                return this.pos > start;
                                                                                                                                                                                                              },
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/runmode/runmode-standalone.js on lines 33..37

                                                                                                                                                                                                          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 69.

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 5137..5141

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 5131..5135

                                                                                                                                                                                                          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

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

                                                                                                                                                                                                          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

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

                                                                                                                                                                                                              skipTo: function(ch) {
                                                                                                                                                                                                                var found = this.string.indexOf(ch, this.pos);
                                                                                                                                                                                                                if (found > -1) {this.pos = found; return true;}
                                                                                                                                                                                                              },
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/runmode/runmode-standalone.js on lines 39..42

                                                                                                                                                                                                          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.scrollTop != null) {
                                                                                                                                                                                                                  setScrollTop(cm, scrollPos.scrollTop);
                                                                                                                                                                                                                  if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true;
                                                                                                                                                                                                                }
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2680..2683

                                                                                                                                                                                                          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 (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
                                                                                                                                                                                                                    end = rightPos;
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 852..853

                                                                                                                                                                                                          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 61.

                                                                                                                                                                                                          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 (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
                                                                                                                                                                                                                    start = leftPos;
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 854..855

                                                                                                                                                                                                          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 61.

                                                                                                                                                                                                          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

                                                                                                                                                                                                              next: function() {
                                                                                                                                                                                                                if (this.pos < this.string.length)
                                                                                                                                                                                                                  return this.string.charAt(this.pos++);
                                                                                                                                                                                                              },
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 50 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/runmode/runmode-standalone.js on lines 18..21

                                                                                                                                                                                                          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 51.

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 45 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2015..2015

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 45 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2014..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 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

                                                                                                                                                                                                              pos.scrollLeft = Math.max(0, Math.min(scroll.scrollWidth - scroll.clientWidth, pos.scrollLeft + left));
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2728..2728

                                                                                                                                                                                                          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 49.

                                                                                                                                                                                                          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

                                                                                                                                                                                                              pos.scrollTop = Math.max(0, Math.min(scroll.scrollHeight - scroll.clientHeight, pos.scrollTop + top));
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2729..2729

                                                                                                                                                                                                          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 49.

                                                                                                                                                                                                          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

                                                                                                                                                                                                                var top = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, newScrollPos.scrollTop));
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 1393..1393

                                                                                                                                                                                                          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 49.

                                                                                                                                                                                                          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

                                                                                                                                                                                                                var left = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, newScrollPos.scrollLeft));
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 1392..1392

                                                                                                                                                                                                          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 49.

                                                                                                                                                                                                          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

                                                                                                                                                                                                              eatWhile: function(match) {
                                                                                                                                                                                                                var start = this.pos;
                                                                                                                                                                                                                while (this.eat(match)){}
                                                                                                                                                                                                                return this.pos > start;
                                                                                                                                                                                                              },
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 40 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/addon/runmode/runmode-standalone.js on lines 28..32

                                                                                                                                                                                                          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 48.

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2605..2605

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 2606..2606

                                                                                                                                                                                                          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

                                                                                                                                                                                                              on(d.scrollbarV, "scroll", function() {
                                                                                                                                                                                                                if (d.scroller.clientHeight) setScrollTop(cm, d.scrollbarV.scrollTop);
                                                                                                                                                                                                              });
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 1583..1585

                                                                                                                                                                                                          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 46.

                                                                                                                                                                                                          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

                                                                                                                                                                                                              on(d.scrollbarH, "scroll", function() {
                                                                                                                                                                                                                if (d.scroller.clientHeight) setScrollLeft(cm, d.scrollbarH.scrollLeft);
                                                                                                                                                                                                              });
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 1580..1582

                                                                                                                                                                                                          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 46.

                                                                                                                                                                                                          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 (needsV) {
                                                                                                                                                                                                                d.scrollbarV.style.display = "block";
                                                                                                                                                                                                                d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
                                                                                                                                                                                                                d.scrollbarV.firstChild.style.height =
                                                                                                                                                                                                                  (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 343..351

                                                                                                                                                                                                          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 46.

                                                                                                                                                                                                          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 (needsH) {
                                                                                                                                                                                                                d.scrollbarH.style.display = "block";
                                                                                                                                                                                                                d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0";
                                                                                                                                                                                                                d.scrollbarH.firstChild.style.width =
                                                                                                                                                                                                                  (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + "px";
                                                                                                                                                                                                          Severity: Minor
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 1 other location - About 35 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 334..342

                                                                                                                                                                                                          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 46.

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 3991..3991
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4007..4007
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4009..4009

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 3991..3991
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 3995..3995
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4007..4007

                                                                                                                                                                                                          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 assets/javascripts/codemirror/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 3991..3991
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 3995..3995
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4009..4009

                                                                                                                                                                                                          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 <= startCh : span.from < startCh);
                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                          Found in assets/javascripts/codemirror/codemirror.js and 3 other locations - About 30 mins to fix
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 3995..3995
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4007..4007
                                                                                                                                                                                                          assets/javascripts/codemirror/codemirror.js on lines 4009..4009

                                                                                                                                                                                                          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