qcminecraft/Carbon-Forum-F

View on GitHub
static/editor/third-party/codemirror/codemirror.js

Summary

Maintainability
F
2 mos
Test Coverage

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

var CodeMirror = (function() {
    // This is the function that produces an editor instance. It's
    // closure is used to store the editor state.
    function CodeMirror(place, givenOptions) {
        // Determine effective options based on given values and defaults.
Severity: Minor
Found in static/editor/third-party/codemirror/codemirror.js - About 1 mo 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 2460 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var CodeMirror = (function() {
    // This is the function that produces an editor instance. It's
    // closure is used to store the editor state.
    function CodeMirror(place, givenOptions) {
        // Determine effective options based on given values and defaults.
Severity: Major
Found in static/editor/third-party/codemirror/codemirror.js - About 1 wk to fix

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

    // CodeMirror version 2.2
    //
    // All functions that need access to the editor's state live inside
    // the CodeMirror function. Below that, at the bottom of the file,
    // some utilities are defined.
    Severity: Major
    Found in static/editor/third-party/codemirror/codemirror.js - About 1 wk to fix

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

          function CodeMirror(place, givenOptions) {
              // Determine effective options based on given values and defaults.
              var options = {}, defaults = CodeMirror.defaults;
              for (var opt in defaults)
                  if (defaults.hasOwnProperty(opt))
      Severity: Major
      Found in static/editor/third-party/codemirror/codemirror.js - About 1 wk to fix

        Function updateLinesNoUndo has 90 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
                    var recomputeMaxLength = false, maxLineLength = maxLine.length;
                    if (!options.lineWrapping)
                        doc.iter(from.line, to.line, function(line) {
                            if (line.text.length == maxLineLength) {recomputeMaxLength = true; return true;}
        Severity: Major
        Found in static/editor/third-party/codemirror/codemirror.js - About 3 hrs to fix

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

                  function onMouseDown(e) {
                      setShift(e.shiftKey);
                      // Check whether this is a click in a widget
                      for (var n = e_target(e); n != wrapper; n = n.parentNode)
                          if (n.parentNode == code && n != mover) return;
          Severity: Major
          Found in static/editor/third-party/codemirror/codemirror.js - About 3 hrs to fix

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

                    getHTML: function(sfrom, sto, includePre, tabText, endAt) {
                        var html = [], first = true;
                        if (includePre)
                            html.push(this.className ? '<pre class="' + this.className + '">': "<pre>");
                        function span(text, style) {
            Severity: Major
            Found in static/editor/third-party/codemirror/codemirror.js - About 2 hrs to fix

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

                      function updateDisplay(changes, suppressCallback) {
                          if (!scroller.clientWidth) {
                              showingFrom = showingTo = displayOffset = 0;
                              return;
                          }
              Severity: Major
              Found in static/editor/third-party/codemirror/codemirror.js - About 2 hrs to fix

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

                    function jsTokenBase(stream, state) {
                        var ch = stream.next();
                        if (ch == '"' || ch == "'")
                            return chain(stream, state, jsTokenString(ch));
                        else if (/[\[\]{}\(\),;\:\.]/.test(ch))
                Severity: Minor
                Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                      function inText(stream, state) {
                          function chain(parser) {
                              state.tokenize = parser;
                              return parser(stream, state);
                          }
                  Severity: Minor
                  Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                            function patchDisplay(from, to, intact) {
                                // The first pass removes the DOM nodes that aren't intact.
                                if (!intact.length) lineDiv.innerHTML = "";
                                else {
                                    function killNode(node) {
                    Severity: Minor
                    Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                          function tokenBase(stream, state) {
                              var ch = stream.next();
                              if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
                              else if (ch == "/" && stream.eat("*")) {
                                  state.tokenize = tokenCComment;
                      Severity: Minor
                      Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                function highlightWorker() {
                                    var end = +new Date + options.workTime;
                                    var foundWork = work.length;
                                    while (work.length) {
                                        if (!getLine(showingFrom).stateAfter) var task = showingFrom;
                        Severity: Minor
                        Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

                          Function fromTextArea has 35 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 static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                    function matchBrackets(autoclear) {
                                        var head = sel.inverted ? sel.from : sel.to, line = getLine(head.line), pos = head.ch - 1;
                                        var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
                                        if (!match) return;
                                        var ch = match.charAt(0), forward = match.charAt(1) == ">", d = forward ? 1 : -1, st = line.styles;
                            Severity: Minor
                            Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                      function onDrop(e) {
                                          e.preventDefault();
                                          var pos = posFromMouse(e, true), files = e.dataTransfer.files;
                                          if (!pos || options.readOnly) return;
                                          if (files && files.length && window.FileReader && window.File) {
                              Severity: Minor
                              Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                        function onContextMenu(e) {
                                            var pos = posFromMouse(e);
                                            if (!pos || window.opera) return; // Opera is difficult.
                                            if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
                                                operation(setCursor)(pos.line, pos.ch);
                                Severity: Minor
                                Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                          function setSelection(from, to, oldFrom, oldTo) {
                                              goalColumn = null;
                                              if (oldFrom == null) {oldFrom = sel.from.line; oldTo = sel.to.line;}
                                              if (posEq(sel.from, from) && posEq(sel.to, to)) return;
                                              if (posLess(to, from)) {var tmp = to; to = from; from = tmp;}
                                  Severity: Minor
                                  Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                            function coordsChar(x, y) {
                                                if (y < 0) y = 0;
                                                var th = textHeight(), cw = charWidth(), heightPos = displayOffset + Math.floor(y / th);
                                                var lineNo = lineAtHeight(doc, heightPos);
                                                if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc.size - 1).text.length};
                                    Severity: Minor
                                    Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                              append: function(line) {
                                                  var mylen = this.text.length, mk = line.marked, mymk = this.marked;
                                                  this.text += line.text;
                                                  copyStyles(0, line.text.length, line.styles, this.styles);
                                                  if (mymk) {
                                      Severity: Minor
                                      Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                                function updateGutter() {
                                                    if (!options.gutter && !options.lineNumbers) return;
                                                    var hText = mover.offsetHeight, hEditor = scroller.clientHeight;
                                                    gutter.style.height = (hText - hEditor < 2 ? hEditor : hText) + "px";
                                                    var html = [], i = showingFrom;
                                        Severity: Minor
                                        Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                                  function findPosH(dir, unit) {
                                                      var end = sel.inverted ? sel.from : sel.to, line = end.line, ch = end.ch;
                                                      var lineObj = getLine(line);
                                                      function findNextLine() {
                                                          for (var l = line + dir, e = dir < 0 ? -1 : doc.size; l != e; l += dir) {
                                          Severity: Minor
                                          Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                                    function handleKeyBinding(e) {
                                                        var name = keyNames[e.keyCode], next = keyMap[options.keyMap].auto, bound, dropShift;
                                                        if (name == null || e.altGraphKey) {
                                                            if (next) options.keyMap = next;
                                                            return null;
                                            Severity: Minor
                                            Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

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

                                                      function indentLine(n, how) {
                                                          if (!how) how = "add";
                                                          if (how == "smart") {
                                                              if (!mode.indent) how = "prev";
                                                              else var state = getStateBefore(n);
                                              Severity: Minor
                                              Found in static/editor/third-party/codemirror/codemirror.js - About 1 hr to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                            if (mymark.to == mylen && mymark.sameSet(mark)) {
                                                                                mymark.to = mark.to == null ? null : mark.to + mylen;
                                                                                if (mymark.isDead()) {
                                                                                    mymark.detach(this);
                                                                                    mk.splice(i--, 1);
                                                Severity: Major
                                                Found in static/editor/third-party/codemirror/codemirror.js - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                              if (sto != null) upto = Math.min(upto, sto);
                                                  Severity: Major
                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 45 mins to fix

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

                                                        function JSLexical(indented, column, type, align, prev, info) {
                                                    Severity: Minor
                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                                  if (mark.to != null) upto = Math.min(upto, mark.to);
                                                      Severity: Major
                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                                    if (found != null) {
                                                                                        if (mark.from != null) from = {line: found, ch: mark.from};
                                                                                        if (mark.to != null) to = {line: found, ch: mark.to};
                                                                                    }
                                                        Severity: Major
                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 45 mins to fix

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

                                                              function parseJS(state, style, type, content, stream) {
                                                          Severity: Minor
                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 35 mins to fix

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

                                                                    getHTML: function(sfrom, sto, includePre, tabText, endAt) {
                                                            Severity: Minor
                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 35 mins to fix

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

                                                                      function updateLines(from, to, newText, selFrom, selTo) {
                                                              Severity: Minor
                                                              Found in static/editor/third-party/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 static/editor/third-party/codemirror/codemirror.js - About 35 mins to fix

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

                                                                          clipTo: function(fromOpen, from, toOpen, to, diff) {
                                                                  Severity: Minor
                                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 35 mins to fix

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

                                                                            function updateLinesNoUndo(from, to, newText, selFrom, selTo) {
                                                                    Severity: Minor
                                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 35 mins to fix

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

                                                                              clipTo: function(fromOpen, from, toOpen, to, diff) {
                                                                      Severity: Minor
                                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 35 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                    return ret("operator", null, stream.current());
                                                                        Severity: Major
                                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                          return chain(stream, state, jsTokenComment);
                                                                          Severity: Major
                                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                    if (type == "function") return cont(functiondef);
                                                                            Severity: Major
                                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      if (type == ";") return cont();
                                                                              Severity: Major
                                                                              Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                        if (type == "case") return cont(expression, expect(":"));
                                                                                Severity: Major
                                                                                Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                              return null;
                                                                                  Severity: Major
                                                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                    return ret("operator", null, stream.current());
                                                                                    Severity: Major
                                                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                              if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
                                                                                                  poplex, statement, poplex);
                                                                                      Severity: Major
                                                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

                                                                                                        return "meta";
                                                                                        Severity: Major
                                                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                      return null;
                                                                                          Severity: Major
                                                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                            else return null;
                                                                                            Severity: Major
                                                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                      if (type == "variable") return cont(pushlex("stat"), maybelabel);
                                                                                              Severity: Major
                                                                                              Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

                                                                                                                return ret("regexp", "string");
                                                                                                Severity: Major
                                                                                                Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                                  return selectLine(start.line);
                                                                                                  Severity: Major
                                                                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                                    return ret("comment", "comment");
                                                                                                    Severity: Major
                                                                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

                                                                                                                  return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
                                                                                                                      ret("variable", "variable", word);
                                                                                                      Severity: Major
                                                                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                        return selectWordAt(start);
                                                                                                        Severity: Major
                                                                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

                                                                                                                      else return pos;
                                                                                                          Severity: Major
                                                                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

                                                                                                                        return "atom";
                                                                                                            Severity: Major
                                                                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

                                                                                                                          if (!start) {if (e_target(e) == scroller) e_preventDefault(e); return;}
                                                                                                              Severity: Major
                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

                                                                                                                                return;
                                                                                                                Severity: Major
                                                                                                                Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                                  return "tag";
                                                                                                                  Severity: Major
                                                                                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                            if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
                                                                                                                                block, poplex, poplex);
                                                                                                                    Severity: Major
                                                                                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                                  return ret("error", "error");
                                                                                                                      Severity: Major
                                                                                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

                                                                                                                                if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
                                                                                                                        Severity: Major
                                                                                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

                                                                                                                                  return cont();
                                                                                                                          Severity: Major
                                                                                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

                                                                                                                                        return ret("atom", "hash");
                                                                                                                            Severity: Major
                                                                                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                      if (type == "default") return cont(expect(":"));
                                                                                                                              Severity: Major
                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

                                                                                                                                        if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
                                                                                                                                Severity: Major
                                                                                                                                Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                              return ret("number", "unit");
                                                                                                                                  Severity: Major
                                                                                                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

                                                                                                                                            return pass(pushlex("stat"), expression, expect(";"), poplex);
                                                                                                                                    Severity: Major
                                                                                                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                      Open

                                                                                                                                                  return ret("variable", "variable");
                                                                                                                                      Severity: Major
                                                                                                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                        Open

                                                                                                                                                if (type == ".") return cont(property, maybeoperator);
                                                                                                                                        Severity: Major
                                                                                                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                          Open

                                                                                                                                                      return state.tokenize(stream, state);
                                                                                                                                          Severity: Major
                                                                                                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                            Open

                                                                                                                                                        return ret(null, ch);
                                                                                                                                            Severity: Major
                                                                                                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                              Open

                                                                                                                                                      if (type == "operator") return cont(expression);
                                                                                                                                              Severity: Major
                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                Open

                                                                                                                                                        if (type == "[") return cont(pushlex("]"), commasep(expression, "]"), poplex, maybeoperator);
                                                                                                                                                Severity: Major
                                                                                                                                                Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                  Open

                                                                                                                                                          if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
                                                                                                                                                              statement, poplex, popcontext);
                                                                                                                                                  Severity: Major
                                                                                                                                                  Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                    Open

                                                                                                                                                                return ret(null, "select-op");
                                                                                                                                                    Severity: Major
                                                                                                                                                    Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                      Open

                                                                                                                                                                      return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                        Open

                                                                                                                                                                    else return lexical.indented + (closing ? 0 : indentUnit);
                                                                                                                                                        Severity: Major
                                                                                                                                                        Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                          Open

                                                                                                                                                                      else if (lexical.align) return lexical.column + (closing ? 0 : 1);
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                            Open

                                                                                                                                                                        return ret("keyword", "important");
                                                                                                                                                            Severity: Major
                                                                                                                                                            Found in static/editor/third-party/codemirror/codemirror.js - About 30 mins to fix

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

                                                                                                                                                                  function css(stream, state) {
                                                                                                                                                                      if (stream.match(/^<\/\s*style\s*>/i, false)) {
                                                                                                                                                                          state.token = html;
                                                                                                                                                                          state.localState = null;
                                                                                                                                                                          state.mode = "html";
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 3526..3535

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

                                                                                                                                                              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

                                                                                                                                                                  function javascript(stream, state) {
                                                                                                                                                                      if (stream.match(/^<\/\s*script\s*>/i, false)) {
                                                                                                                                                                          state.token = html;
                                                                                                                                                                          state.curState = null;
                                                                                                                                                                          state.mode = "html";
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 3536..3545

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

                                                                                                                                                              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

                                                                                                                                                                          for (;;) {
                                                                                                                                                                              var estX = getX(estimated);
                                                                                                                                                                              if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
                                                                                                                                                                              else {toX = estX; to = estimated; break;}
                                                                                                                                                                          }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 1430..1434

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

                                                                                                                                                              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

                                                                                                                                                                          for (;;) {
                                                                                                                                                                              var estX = getX(estimated);
                                                                                                                                                                              if (estX <= x && estimated < to) estimated = Math.min(to, Math.ceil(estimated * 1.2));
                                                                                                                                                                              else {toX = estX; to = estimated; break;}
                                                                                                                                                                          }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 2 hrs to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 1360..1364

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

                                                                                                                                                              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

                                                                                                                                                                          else if (/^style$/i.test(state.htmlState.context.tagName)) {
                                                                                                                                                                              state.token = css;
                                                                                                                                                                              state.localState = cssMode.startState(htmlMode.indent(state.htmlState, ""));
                                                                                                                                                                              state.mode = "css";
                                                                                                                                                                          }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 3507..3516

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

                                                                                                                                                              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 (/^script$/i.test(state.htmlState.context.tagName)) {
                                                                                                                                                                              state.token = javascript;
                                                                                                                                                                              state.localState = jsMode.startState(htmlMode.indent(state.htmlState, ""));
                                                                                                                                                                              state.mode = "javascript";
                                                                                                                                                                          }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 3512..3516

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

                                                                                                                                                              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 3 locations. Consider refactoring.
                                                                                                                                                              Open

                                                                                                                                                                                  for (var i = 1, e = newText.length - 1; i < e; ++i)
                                                                                                                                                                                      added.push(Line.inheritMarks(newText[i], firstLine));
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 2 other locations - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 570..571
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 597..598

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

                                                                                                                                                              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 3 locations. Consider refactoring.
                                                                                                                                                              Open

                                                                                                                                                                              for (var i = 0, e = newText.length - 1; i < e; ++i)
                                                                                                                                                                                  added.push(Line.inheritMarks(newText[i], prevLine));
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 2 other locations - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 582..583
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 597..598

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

                                                                                                                                                              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 3 locations. Consider refactoring.
                                                                                                                                                              Open

                                                                                                                                                                              for (var i = 1, e = newText.length - 1; i < e; ++i)
                                                                                                                                                                                  added.push(Line.inheritMarks(newText[i], firstLine));
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 2 other locations - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 570..571
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 582..583

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

                                                                                                                                                              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

                                                                                                                                                                  function pass() {
                                                                                                                                                                      for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
                                                                                                                                                                  }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 3170..3172

                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                              Tuning

                                                                                                                                                              This issue has a mass of 55.

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

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

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

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

                                                                                                                                                              Refactorings

                                                                                                                                                              Further Reading

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

                                                                                                                                                                  function pass() {
                                                                                                                                                                      for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
                                                                                                                                                                  }
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 1 hr to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 2888..2890

                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                              Tuning

                                                                                                                                                              This issue has a mass of 55.

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

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

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

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

                                                                                                                                                              Refactorings

                                                                                                                                                              Further Reading

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

                                                                                                                                                                          doc.iter(start, n, function(line) {
                                                                                                                                                                              line.highlight(mode, state, options.tabSize);
                                                                                                                                                                              line.stateAfter = copyState(mode, state);
                                                                                                                                                                          });
                                                                                                                                                              Severity: Minor
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 50 mins to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 1608..1611

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

                                                                                                                                                              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

                                                                                                                                                                          doc.iter(start, end, function(line) {
                                                                                                                                                                              line.highlight(mode, state, options.tabSize);
                                                                                                                                                                              line.stateAfter = copyState(mode, state);
                                                                                                                                                                          });
                                                                                                                                                              Severity: Minor
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 50 mins to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 1598..1601

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

                                                                                                                                                              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

                                                                                                                                                                          cursorCoords: function(start){
                                                                                                                                                                              if (start == null) start = sel.inverted;
                                                                                                                                                                              return pageCoords(start ? sel.from : sel.to);
                                                                                                                                                                          },
                                                                                                                                                              Severity: Minor
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 50 mins to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 223..226

                                                                                                                                                              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

                                                                                                                                                                          getCursor: function(start) {
                                                                                                                                                                              if (start == null) start = sel.inverted;
                                                                                                                                                                              return copyPos(start ? sel.from : sel.to);
                                                                                                                                                                          },
                                                                                                                                                              Severity: Minor
                                                                                                                                                              Found in static/editor/third-party/codemirror/codemirror.js and 1 other location - About 50 mins to fix
                                                                                                                                                              static/editor/third-party/codemirror/codemirror.js on lines 168..171

                                                                                                                                                              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

                                                                                                                                                              There are no issues that match your filters.

                                                                                                                                                              Category
                                                                                                                                                              Status