SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js

Summary

Maintainability
F
2 yrs
Test Coverage

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

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

// This is CodeMirror (http://codemirror.net), a code editor
// implemented in JavaScript on top of the browser's DOM.

Function addEditorMethods has 378 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function addEditorMethods(CodeMirror) {
  var optionHandlers = CodeMirror.optionHandlers

  var helpers = CodeMirror.helpers = {}

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

function defineOptions(CodeMirror) {
  var optionHandlers = CodeMirror.optionHandlers

  function option(name, deflt, handle, notOnInit) {
    CodeMirror.defaults[name] = deflt

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

function leftButtonSelect(cm, event, start, behavior) {
  var display = cm.display, doc = cm.doc
  e_preventDefault(event)

  var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges

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

var bidiOrdering = (function() {
  // Character types for codepoints 0 to 0xff
  var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
  // Character types for codepoints 0x600 to 0x6f9
  var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"

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

function registerEventHandlers(cm) {
  var d = cm.display
  on(d.scroller, "mousedown", operation(cm, onMouseDown))
  // Older IE's will not fire a second mousedown for a double click
  if (ie && ie_version < 11)

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

function drawSelectionRange(cm, range, output) {
  var display = cm.display, doc = cm.doc
  var fragment = document.createDocumentFragment()
  var padding = paddingH(cm.display), leftSide = padding.left
  var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right

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

ContentEditableInput.prototype.init = function (display) {
    var this$1 = this;

  var input = this, cm = input.cm
  var div = input.div = display.lineDiv

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

TextareaInput.prototype.onContextMenu = function (e) {
  var input = this, cm = input.cm, display = cm.display, te = input.textarea
  var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop
  if (!pos || presto) { return } // Opera is difficult.

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

function insertLineContent(line, builder, styles) {
  var spans = line.markedSpans, allText = line.text, at = 0
  if (!spans) {
    for (var i$1 = 1; i$1 < styles.length; i$1+=2)
      { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }

Function pollContent has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ContentEditableInput.prototype.pollContent = function () {
  if (this.readDOMTimeout != null) {
    clearTimeout(this.readDOMTimeout)
    this.readDOMTimeout = null
  }

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

function buildToken(builder, text, style, startStyle, endStyle, title, css) {
  if (!text) { return }
  var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
  var special = builder.cm.state.specialChars, mustWrap = false
  var content

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

TextareaInput.prototype.init = function (display) {
    var this$1 = this;

  var input = this, cm = this.cm
  this.createField(display)

Consider simplifying this complex logical expression.
Open

        if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
              span.from == null && lineNo != from.line ||
              span.from != null && lineNo == to.line && span.from >= to.ch) &&
            (!filter || filter(span.marker)))
          { found.push(span.marker.parent || span.marker) }
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 2 hrs to fix

Function regChange has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function regChange(cm, from, to, lendiff) {
  if (from == null) { from = cm.doc.first }
  if (to == null) { to = cm.doc.first + cm.doc.size }
  if (!lendiff) { lendiff = 0 }

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

function makeChangeFromHistory(doc, type, allowSelectionOnly) {
  var suppress = doc.cm && doc.cm.state.suppressEdits
  if (suppress && !allowSelectionOnly) { return }

  var hist = doc.history, event, selAfter = doc.sel

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

function markText(doc, from, to, options, type) {
  // Shared markers (across linked documents) are handled separately
  // (markTextShared will call out to this again, once per
  // document).
  if (options && options.shared) { return markTextShared(doc, from, to, options, type) }

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

function onDrop(e) {
  var cm = this
  clearDragCursor(cm)
  if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
    { return }

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

function findPosH(doc, pos, dir, unit, visually) {
  var oldPos = pos
  var origDir = dir
  var lineObj = getLine(doc, pos.line)
  function findNextLine() {

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

function CodeMirror(place, options) {
  var this$1 = this;

  if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }

Function Display has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Display(place, doc, input) {
  var d = this
  this.input = input

  // Covers bottom-right square when both scrollbars are present.

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

function moveVisually(cm, line, start, dir) {
  var bidi = getOrder(line, cm.doc.direction)
  if (!bidi) { return moveLogically(line, start, dir) }
  if (start.ch >= line.text.length) {
    start.ch = line.text.length

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

function onScrollWheel(cm, e) {
  var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y

  var display = cm.display, scroll = display.scroller
  // Quit if there's nothing to scroll here

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

function stretchSpansOverChange(doc, change) {
  if (change.full) { return null }
  var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
  var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
  if (!oldFirst && !oldLast) { return null }

Function updateDisplayIfNeeded has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateDisplayIfNeeded(cm, update) {
  var display = cm.display, doc = cm.doc

  if (update.editorIsHidden) {
    resetView(cm)

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

function indentLine(cm, n, how, aggressive) {
  var doc = cm.doc, state
  if (how == null) { how = "add" }
  if (how == "smart") {
    // Fall back to "prev" when the mode doesn't have an indentation

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

  function drawForLine(line, fromArg, toArg) {
    var lineObj = getLine(doc, line)
    var lineLen = lineObj.text.length
    var start, end
    function coords(ch, bias) {

Function locateNodeInLineView has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function locateNodeInLineView(lineView, node, offset) {
  var wrapper = lineView.text.firstChild, bad = false
  if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
  if (node == wrapper) {
    bad = true

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

function makeChangeSingleDocInEditor(cm, change, spans) {
  var doc = cm.doc, display = cm.display, from = change.from, to = change.to

  var recomputeMaxLength = false, checkWidthStart = from.line
  if (!cm.options.lineWrapping) {

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

function fromTextArea(textarea, options) {
  options = options ? copyObj(options) : {}
  options.value = textarea.value
  if (!options.tabindex && textarea.tabIndex)
    { options.tabindex = textarea.tabIndex }

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

function measureCharInner(cm, prepared, ch, bias) {
  var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
  var node = place.node, start = place.start, end = place.end, collapse = place.collapse

  var rect

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

function domTextBetween(cm, from, to, fromLine, toLine) {
  var text = "", closing = false, lineSep = cm.doc.lineSeparator()
  function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
  function close() {
    if (closing) {

Function showPrimarySelection has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

ContentEditableInput.prototype.showPrimarySelection = function () {
  var sel = window.getSelection(), cm = this.cm, prim = cm.doc.sel.primary()
  var from = prim.from(), to = prim.to()

  if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {

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

function updateDoc(doc, change, markedSpans, estimateHeight) {
  function spansFor(n) {return markedSpans ? markedSpans[n] : null}
  function update(line, text, spans) {
    updateLine(line, text, spans, estimateHeight)
    signalLater(line, "change", line, change)

Consider simplifying this complex logical expression.
Open

  if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
      repeat == "single" && (contained = sel.contains(pos)) > -1 &&
      (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
      (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
    { leftButtonStartDrag(cm, event, pos, behavior) }
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

        if (ltr) {
          topLeft = docLTR && openStart && first ? leftSide : fromPos.left
          topRight = docLTR ? rightSide : wrapX(from, dir, "before")
          botLeft = docLTR ? leftSide : wrapX(to, dir, "after")
          botRight = docLTR && openEnd && last ? rightSide : toPos.right
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 1 hr to fix

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

function addLegacyProps(CodeMirror) {
  CodeMirror.off = off
  CodeMirror.on = on
  CodeMirror.wheelEventPixels = wheelEventPixels
  CodeMirror.Doc = Doc

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

function coordsCharInner(cm, lineObj, lineNo, x, y) {
  // Move y into line-local coordinate space
  y -= heightAtLine(lineObj)
  var preparedMeasure = prepareMeasureForLine(cm, lineObj)
  // When directly calling `measureCharPrepared`, we have to adjust

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

function applyTextInput(cm, inserted, deleted, sel, origin) {
  var doc = cm.doc
  cm.display.shift = false
  if (!sel) { sel = doc.sel }

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

function buildLineContent(cm, lineView) {
  // The padding-right forces the element to have a 'border', which
  // is needed on Webkit to be able to get line-level bounding
  // rectangles for it (in measureChar).
  var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null)

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

TextMarker.prototype.clear = function () {
    var this$1 = this;

  if (this.explicitlyCleared) { return }
  var cm = this.doc.cm, withOp = cm && !cm.curOp

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

function highlightWorker(cm) {
  var doc = cm.doc
  if (doc.highlightFrontier >= cm.display.viewTo) { return }
  var end = +new Date + cm.options.workTime
  var context = getContextBefore(cm, doc.highlightFrontier)

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

function updateLineGutter(cm, lineView, lineN, dims) {
  if (lineView.gutter) {
    lineView.node.removeChild(lineView.gutter)
    lineView.gutter = null
  }

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

  function onCopyCut(e) {
    if (signalDOMEvent(cm, e)) { return }
    if (cm.somethingSelected()) {
      setLastCopied({lineWise: false, text: cm.getSelections()})
      if (e.type == "cut") { cm.replaceSelection("", null, "cut") }

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

function highlightLine(cm, line, context, forceToEnd) {
  // A styles array always starts with a number identifying the
  // mode/overlays that it is based on (for easy invalidation).
  var st = [cm.state.modeGen], lineClasses = {}
  // Compute the base array of styles

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

  function extendTo(pos) {
    if (cmp(lastPos, pos) == 0) { return }
    lastPos = pos

    if (behavior.unit == "rectangle") {

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

function patchDisplay(cm, updateNumbersFrom, dims) {
  var display = cm.display, lineNumbers = cm.options.lineNumbers
  var container = display.lineDiv, cur = container.firstChild

  function rm(node) {

Consider simplifying this complex logical expression.
Open

    if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
        (sp.to == null || sp.to != span.from) &&
        (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
        lineIsHiddenInner(doc, line, sp)) { return true }
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

    if (context.line >= cm.display.viewFrom) { // Visible
      var oldStyles = line.styles
      var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null
      var highlighted = highlightLine(cm, line, context, true)
      if (resetState) { context.state = resetState }
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 1 hr to fix

Consider simplifying this complex logical expression.
Open

  if (this.contextMenuPending || !cm.state.focused ||
      (hasSelection(input) && !prevInput && !this.composing) ||
      cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
    { return false }
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 1 hr to fix

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

function nodeAndOffsetInLineMap(map, ch, bias) {
  var node, start, end, collapse, mStart, mEnd
  // First, search the line map for the text node corresponding to,
  // or closest to, the target character.
  for (var i = 0; i < map.length; i += 3) {

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

function addChangeToHistory(doc, change, selAfter, opId) {
  var hist = doc.history
  hist.undone.length = 0
  var time = +new Date, cur
  var last

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

function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
  var flattenSpans = mode.flattenSpans
  if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans }
  var curStart = 0, curStyle = null
  var stream = new StringStream(text, cm.options.tabSize, context), style

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

function leftButtonStartDrag(cm, event, pos, behavior) {
  var display = cm.display, moved = false
  var dragEnd = operation(cm, function (e) {
    if (webkit) { display.scroller.draggable = false }
    cm.state.draggingText = false

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

TextareaInput.prototype.poll = function () {
    var this$1 = this;

  var cm = this.cm, input = this.textarea, prevInput = this.prevInput
  // Since this is called a *lot*, try to bail out as cheaply as

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

    addWidget: function(pos, node, scroll, vert, horiz) {
      var display = this.display
      pos = cursorCoords(this, clipPos(this.doc, pos))
      var top = pos.bottom, left = pos.left
      node.style.position = "absolute"

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

NativeScrollbars.prototype.update = function (measure) {
  var needsH = measure.scrollWidth > measure.clientWidth + 1
  var needsV = measure.scrollHeight > measure.clientHeight + 1
  var sWidth = measure.nativeBarWidth

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

function scrollPosIntoView(cm, pos, end, margin) {
  if (margin == null) { margin = 0 }
  var rect
  if (!cm.options.lineWrapping && pos == end) {
    // Set pos and end to the cursor positions around the character pos sticks to

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

function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
  var line = getLine(doc, pos.line)
  if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
    var sp = line.markedSpans[i], m = sp.marker
    if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&

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

function onMouseDown(e) {
  var cm = this, display = cm.display
  if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
  display.input.ensurePolled()
  display.shift = e.shiftKey

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

  var loop = function ( o ) {
    context.baseTokens = st
    var overlay = cm.state.overlays[o], i = 1, at = 0
    context.state = true
    runMode(cm, line.text, overlay.mode, context, function (end, style) {

Consider simplifying this complex logical expression.
Open

  if ((hist.lastOp == opId ||
       hist.lastOrigin == change.origin && change.origin &&
       ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
        change.origin.charAt(0) == "*")) &&
      (cur = lastChangeEvent(hist, hist.lastOp == opId))) {

Consider simplifying this complex logical expression.
Open

  if (!update.force &&
      update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
      display.renderedView == display.view && countDirtyView(cm) == 0)
    { return false }

Consider simplifying this complex logical expression.
Open

    if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
      ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
    }

Consider simplifying this complex logical expression.
Open

    if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
      ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
                                            span.to == null ? null : span.to - endCh))
    }

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

function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 50 mins to fix

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

function buildToken(builder, text, style, startStyle, endStyle, title, css) {
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 50 mins to fix

Function coordsBidiPartWrapped has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 50 mins to fix

Function coordsBidiPart has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 50 mins to fix

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

function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          { if (oldCur[k].marker == span.marker) { continue spans } }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (sp.to != null && sp.to != pos && nextChange > sp.to) {
            nextChange = sp.to
            spanEndStyle = ""
          }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if (m.explicitlyCleared) {
          if (!line.markedSpans) { break }
          else {--i; continue}
        }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
        if (indexOf(newGroup, Number(m[1])) > -1) {
          lst(newChanges)[prop] = change[prop]
          delete change[prop]
        }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (m.className) { spanStyle += " " + m.className }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (m.css) { css = (css ? css + ";" : "") + m.css }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (m.title && !title) { title = m.title }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

    if (cut$1) {
      display.view = display.view.slice(0, cut$1.index)
      display.viewTo = cut$1.lineN
    } else {
      resetView(cm)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
          { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
            { collapsed = sp }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (sameLine) { (first || (first = [])).push(span$1) }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
          { return skipAtomicInner(doc, near, pos, dir, mayClear) }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

        } else if (sp.from > pos && nextChange > sp.from) {
          nextChange = sp.from
        }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

    if (cutTop && cutBot) {
      display.view = display.view.slice(0, cutTop.index)
        .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
        .concat(display.view.slice(cutBot.index))
      display.viewTo += lendiff
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

            for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

        } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
          if (sp.to != null && sp.to != pos && nextChange > sp.to) {
            nextChange = sp.to
            spanEndStyle = ""
          }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  if (opId == hist.lastSelOp ||
      (origin && hist.lastSelOrigin == origin &&
       (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
        selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
    { hist.done[hist.done.length - 1] = sel }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
    { return false }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
      cmp(minPos(curAnchor, curFocus), from) == 0 &&
      cmp(maxPos(curAnchor, curFocus), to) == 0)
    { return }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  } else if (unit == "word" || unit == "group") {
    var sawType = null, group = unit == "group"
    var helper = doc.cm && doc.cm.getHelper(pos, "wordChars")
    for (var first = true;; first = false) {
      if (dir < 0 && !moveOnce(!first)) { break }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if (display.wheelStartX == null) {
      display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop
      display.wheelDX = dx; display.wheelDY = dy
      setTimeout(function () {
        if (display.wheelStartX == null) { return }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
    var rSpan = node.parentNode.getClientRects()[0]
    if (rSpan)
      { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} }
    else
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

    if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
        fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
      { return true }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

Consider simplifying this complex logical expression.
Open

  if (style || startStyle || endStyle || mustWrap || css) {
    var fullStyle = style || ""
    if (startStyle) { fullStyle += startStyle }
    if (endStyle) { fullStyle += endStyle }
    var token = elt("span", [content], fullStyle, css)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 40 mins to fix

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

function findPosH(doc, pos, dir, unit, visually) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function markText(doc, from, to, options, type) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function extendSelection(doc, head, other, options, extend) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function charCoords(cm, pos, context, lineObj, bias) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function skipAtomic(doc, pos, oldPos, bias, mayClear) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function markTextShared(doc, from, to, options, type) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

var Doc = function(text, mode, firstLine, lineSep, direction) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function handleMappedButton(cm, button, pos, repeat, event) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function coordsCharInner(cm, lineObj, lineNo, x, y) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function endOfLine(visually, cm, lineObj, lineNo, dir) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function PosWithInfo(line, ch, sticky, outside, xRel) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function domTextBetween(cm, from, to, fromLine, toLine) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function replaceRange(doc, code, from, to, origin) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function countColumn(string, end, tabSize, startIndex, startValue) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function applyTextInput(cm, inserted, deleted, sel, origin) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

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

function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
Severity: Minor
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/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 de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 35 mins to fix

Avoid too many return statements within this function.
Open

      if (result) { return result }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return null
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    else { return "L" }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    else if (0x2000 <= code && code <= 0x200b) { return "w" }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  if (handleCharBinding(cm, e, ch)) { return }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      { return badPos(Pos(found.line, found.ch + dist$1), bad) }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    else if (code == 0x200c) { return "b" }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return new Pos(pos.line, pos.ch + dir)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if ( returned ) return returned.v;
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    if (res) { return res }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

  return true
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/codemirror.js - About 30 mins to fix

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

(function (global, factory) {
    global.CodeMirror = factory();
}(this, (function () { 'use strict';

// Kludges for bugs and behavior differences that can't be feature
de.bund.bfr.knime.fsklab.deprecatednodes/js-src/de/bund/bfr/knime/fsklab/nodes/joiner/fskemfeditor/codemirror.js on lines 10..9663

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

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