SiLeBAT/FSK-Lab

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

Summary

Maintainability
F
2 mos
Test Coverage

File markdown.js has 727 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS

Function inlineNormal has 203 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function inlineNormal(stream, state) {
    var style = state.text(stream, state);
    if (typeof style !== 'undefined')
      return style;

Function blockNormal has 105 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function blockNormal(stream, state) {
    var firstTokenOnLine = stream.column() === state.indentation;
    var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
    var prevLineIsIndentedCode = state.indentedCode;
    var prevLineIsHr = state.prevLine.hr;

Function getType has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function getType(state) {
    var styles = [];

    if (state.formatting) {
      styles.push(tokenTypes.formatting);

Consider simplifying this complex logical expression.
Open

    } else if (
      // if setext set, indicates line after ---/===
      state.setext || (
        // line before ---/===
        (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 2 hrs to fix

Consider simplifying this complex logical expression.
Open

    } else if (ch === "*" || ch === "_") {
      var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
      while (len < 3 && stream.eat(ch)) len++
      var after = stream.peek() || " "
      // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
Severity: Critical
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 2 hrs to fix

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

    copyState: function(s) {
      return {
        f: s.f,

        prevLine: s.prevLine,

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

    startState: function() {
      return {
        f: blockNormal,

        prevLine: {stream: null},

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

  function blankLine(state) {
    // Reset linkTitle state
    state.linkTitle = false;
    state.linkHref = false;
    state.linkText = false;

Avoid deeply nested control flow statements.
Open

          if (stream.peek() === ' ') { // Surrounded by spaces, ignore
            return getType(state);
          } else { // Not surrounded by spaces, back up pointer
            stream.backUp(2);
          }
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

    } else if (
      // if setext set, indicates line after ---/===
      state.setext || (
        // line before ---/===
        (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      if (modeCfg.highlightFormatting) state.formatting = "code-block";
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 45 mins to fix

Consider simplifying this complex logical expression.
Open

      if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
           (!inner.state.context && inner.state.tokenize.isInText)) ||
          (state.md_inside && stream.current().indexOf(">") > -1)) {
        state.f = inlineNormal;
        state.block = blockNormal;
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 40 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

      return type + tokenTypes.linkInline;
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

        return type ? type + " " + formattingEscape : formattingEscape;
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

      return switchBlock(stream, state, htmlBlock);
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

    return switchInline(stream, state, state.inline);
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return getType(state)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

      if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return switchInline(stream, state, footnoteLink);
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

      return type + tokenTypes.linkEmail;
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

        return getType(state)
Severity: Major
Found in de.bund.bfr.knime.fsklab.deprecatednodes/js-lib/codemirror/markdown.js - About 30 mins to fix

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

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/markdown/markdown.js on lines 4..883

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

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