SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/javascript/javascript.js

Summary

Maintainability
F
1 wk
Test Coverage

File javascript.js has 861 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 tokenBase has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function tokenBase(stream, state) {
    var ch = stream.next();
    if (ch == '"' || ch == "'") {
      state.tokenize = tokenString(ch);
      return state.tokenize(stream, state);

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

  function statement(type, value) {
    if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
    if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
    if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
    if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);

Consider simplifying this complex logical expression.
Open

    if (type == "async" ||
        (type == "variable" &&
         (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
         cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
      cx.marked = "keyword";

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

  function findFatArrow(stream, state) {
    if (state.fatArrowAt) state.fatArrowAt = null;
    var arrow = stream.string.indexOf("=>", stream.start);
    if (arrow < 0) return;

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

  function objprop(type, value) {
    if (type == "async") {
      cx.marked = "property";
      return cont(objprop);
    } else if (type == "variable" || cx.style == "keyword") {

Avoid deeply nested control flow statements.
Open

          if (next == ch && stream.string.charAt(pos - 2) != "\\") { pos--; break }

Avoid deeply nested control flow statements.
Open

          if (ch == "!" || ch == "=") stream.eat("=")

Avoid deeply nested control flow statements.
Open

        if (keywords.propertyIsEnumerable(word)) {
          var kw = keywords[word]
          return ret(kw.type, kw.style, word)
        }

Avoid deeply nested control flow statements.
Open

          if (pos == 0) return

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

  function JSLexical(indented, column, type, align, prev, info) {

Avoid deeply nested control flow statements.
Open

        if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
          return ret("async", "keyword", word)

Avoid deeply nested control flow statements.
Open

        } else if (/[<>*+\-]/.test(ch)) {
          stream.eat(ch)
          if (ch == ">") stream.eat(ch)
        }

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

  function parseJS(state, style, type, content, stream) {

Avoid too many return statements within this function.
Open

    if (type == "quasi") return pass(quasi, maybeop);

Avoid too many return statements within this function.
Open

      return cont(expression, maybetype, expect("]"), afterprop);

Avoid too many return statements within this function.
Open

    if (type == "}") return cont();

Avoid too many return statements within this function.
Open

      return ret("operator", "operator", stream.current());

Avoid too many return statements within this function.
Open

        return cont(pushlex("stat"), maybelabel);

Avoid too many return statements within this function.
Open

    if (type == "case") return cont(expression, expect(":"));

Avoid too many return statements within this function.
Open

    return pass(pushlex("stat"), expression, expect(";"), poplex);

Avoid too many return statements within this function.
Open

    if (type == "new") return cont(maybeTarget(noComma));

Avoid too many return statements within this function.
Open

      return cont(objprop);

Avoid too many return statements within this function.
Open

      else return lexical.indented + (closing ? 0 : indentUnit);

Avoid too many return statements within this function.
Open

      return ret("number", "number");

Avoid too many return statements within this function.
Open

      return tokenQuasi(stream, state);

Avoid too many return statements within this function.
Open

      return ret("error", "error");

Avoid too many return statements within this function.
Open

    if (type == "function") return cont(functiondef);

Avoid too many return statements within this function.
Open

    if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)

Avoid too many return statements within this function.
Open

        return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);

Avoid too many return statements within this function.
Open

      return ret("=>", "operator");

Avoid too many return statements within this function.
Open

      return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);

Avoid too many return statements within this function.
Open

    if (type == "export") return cont(pushlex("stat"), afterExport, poplex);

Avoid too many return statements within this function.
Open

    if (type == "{") return contCommasep(proppattern, "}");

Avoid too many return statements within this function.
Open

    return cont(expect(":"), pattern, maybeAssign);

Avoid too many return statements within this function.
Open

      return ret("number", "number");

Avoid too many return statements within this function.
Open

    if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);

Avoid too many return statements within this function.
Open

    if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);

Avoid too many return statements within this function.
Open

          return ret("async", "keyword", word)

Avoid too many return statements within this function.
Open

      return context

Avoid too many return statements within this function.
Open

    if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }

Avoid too many return statements within this function.
Open

    if (type == ".") return cont(property, me);

Avoid too many return statements within this function.
Open

    if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }

Avoid too many return statements within this function.
Open

    if (value == "?") return cont(typeexpr, expect(":"), typeexpr)

Avoid too many return statements within this function.
Open

        return ret("operator", "operator", stream.current());

Avoid too many return statements within this function.
Open

    if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);

Avoid too many return statements within this function.
Open

    if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)

Avoid too many return statements within this function.
Open

        return ret("comment", "comment");

Avoid too many return statements within this function.
Open

      return ret("variable", "variable", word)

Avoid too many return statements within this function.
Open

        return cont(pushlex("form"), expression, statement, poplex)

Avoid too many return statements within this function.
Open

    if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);

Avoid too many return statements within this function.
Open

      return cont(expr)

Avoid too many return statements within this function.
Open

      else if (type == "form") return lexical.indented + indentUnit;

Avoid too many return statements within this function.
Open

        return tokenComment(stream, state);

Avoid too many return statements within this function.
Open

        return cont(statement)

Avoid too many return statements within this function.
Open

      return cont(expressionNoComma, afterprop);

Avoid too many return statements within this function.
Open

    if (isTS && type == "(") return pass(functiondecl, classBody)

Avoid too many return statements within this function.
Open

      return ret("comment", "comment")

Avoid too many return statements within this function.
Open

      return new Context(context.prev, new Var(varname, context.vars), false)

Avoid too many return statements within this function.
Open

    if (type == ";") return cont();

Avoid too many return statements within this function.
Open

    if (type == "import") return cont(pushlex("stat"), afterImport, poplex);

Avoid too many return statements within this function.
Open

    if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);

Avoid too many return statements within this function.
Open

    return cont();

Avoid too many return statements within this function.
Open

    if (type == "quasi") { return pass(quasi, me); }

Avoid too many return statements within this function.
Open

      return pass(afterprop)

Avoid too many return statements within this function.
Open

      return pass(functiondecl, typeprop)

Avoid too many return statements within this function.
Open

      return cont(classBody);

Avoid too many return statements within this function.
Open

          return ret(kw.type, kw.style, word)

Avoid too many return statements within this function.
Open

        if (value == "enum") return cont(enumdef);

Avoid too many return statements within this function.
Open

    if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);

Avoid too many return statements within this function.
Open

    if (type == ";" || type == ",") return cont(classBody);

Avoid too many return statements within this function.
Open

    if (value == "@") return cont(expression, classBody)

Avoid too many return statements within this function.
Open

        return ret("regexp", "string-2");

Avoid too many return statements within this function.
Open

    if (value == "@") return cont(expression, statement)

Avoid too many return statements within this function.
Open

    if (type == "import") return cont(expression);

Avoid too many return statements within this function.
Open

      return cont(afterprop);

Avoid too many return statements within this function.
Open

      return cont(objprop)

Avoid too many return statements within this function.
Open

    if (type == "debugger") return cont(expect(";"));

Avoid too many return statements within this function.
Open

        else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)

Avoid too many return statements within this function.
Open

        return cont(statement)

Avoid too many return statements within this function.
Open

    if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);

Avoid too many return statements within this function.
Open

    if (type == "async") return cont(statement)

Avoid too many return statements within this function.
Open

    if (type == ";") return;

Avoid too many return statements within this function.
Open

    if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)

Avoid too many return statements within this function.
Open

      return cont(pushlex("form", type == "class" ? type : value), className, poplex)

Avoid too many return statements within this function.
Open

    if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
                                      block, poplex, poplex, popcontext);

Avoid too many return statements within this function.
Open

    if (type == "default") return cont(expect(":"));

Avoid too many return statements within this function.
Open

      return cont(expr);

Avoid too many return statements within this function.
Open

    if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)

Avoid too many return statements within this function.
Open

        return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);

Avoid too many return statements within this function.
Open

    if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);

Avoid too many return statements within this function.
Open

        else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));

Avoid too many return statements within this function.
Open

    if (type == "{") return contCommasep(objprop, "}", null, maybeop);

Avoid too many return statements within this function.
Open

    if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);

Avoid too many return statements within this function.
Open

      else if (lexical.align) return lexical.column + (closing ? 0 : 1);

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

  function poplex() {
    var state = cx.state;
    if (state.lexical.prev) {
      if (state.lexical.type == ")")
        state.indented = state.lexical.indented;
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 231..238

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

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 JSLexical(indented, column, type, align, prev, info) {
    this.indented = indented;
    this.column = column;
    this.type = type;
    this.prev = prev;
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 134..141

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

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 tokenComment(stream, state) {
    var maybeEnd = false, ch;
    while (ch = stream.next()) {
      if (ch == "/" && maybeEnd) {
        state.tokenize = tokenBase;
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 118..128

Duplicated Code

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

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

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

Tuning

This issue has a mass of 78.

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

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

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

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

Refactorings

Further Reading

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

  function popcontext() {
    cx.state.localVars = cx.state.context.vars
    cx.state.context = cx.state.context.prev
  }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 218..221

Duplicated Code

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

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

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

Tuning

This issue has a mass of 62.

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

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

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

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

Refactorings

Further Reading

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

  function pass() {
    for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
  }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 187..189
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/tiki/tiki.js on lines 194..196

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

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

  function inList(name, list) {
    for (var v = list; v; v = v.next) if (v.name == name) return true
    return false;
  }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 194..198

Duplicated Code

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

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

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

Tuning

This issue has a mass of 50.

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

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

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

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

Refactorings

Further Reading

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

  function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/css/css.js on lines 119..123

Duplicated Code

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

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

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

Tuning

This issue has a mass of 46.

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

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

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

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

Refactorings

Further Reading

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

    for (var cx = state.context; cx; cx = cx.prev) {
      for (var v = cx.vars; v; v = v.next)
        if (v.name == varname) return true;
    }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haxe/haxe.js on lines 143..146

Duplicated Code

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

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

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

Tuning

This issue has a mass of 45.

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

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

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

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

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status