SiLeBAT/FSK-Lab

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

Summary

Maintainability
F
4 days
Test Coverage

File erlang.js has 470 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

/*jshint unused:true, eqnull:true, curly:true, bitwise:true */
/*jshint undef:true, latedef:true, trailing:true */
Severity: Minor
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 7 hrs to fix

Function tokenizer has 138 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function tokenizer(stream,state) {
    // in multi-line string
    if (state.in_string) {
      state.in_string = (!doubleQuote(stream));
      return rval(state,stream,"string");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 5 hrs to fix

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

  function indenter(state,textAfter) {
    var t;
    var unit = cmCfg.indentUnit;
    var wordAfter = wordafter(textAfter);
    var currT = peekToken(state,1);
Severity: Minor
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 1 hr to fix

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

  function rval(state,stream,type) {

    // parse stack
    pushToken(state,realToken(type,stream));

Severity: Minor
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 1 hr to fix

Avoid deeply nested control flow statements.
Open

          if (stream.eat(/[eE]/)) {        // float with exponent
            if (stream.eat(/[-+]/)) {
              if (!stream.eatWhile(digitRE)) {
                stream.backUp(2);            // "2e-" - syntax error
              }
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 45 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"colon");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"error");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"boolean");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return  currT.column+3;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return prevT.column+unit+unit;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return currT.column+currT.token.length;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return truthy(t) ? t.column+unit : 0;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"string");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"builtin");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"operator");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return prevT.column+unit;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"close_paren");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"separator");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

    return rval(state,stream,null);
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return t ? t.column : CodeMirror.Pass;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"dot");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return t ? t.column+t.token.length : unit;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"atom");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"function");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"number");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"function");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"keyword");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"guard");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"number");   // normal integer
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"operator");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"record");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"function");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"open_paren");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return t ? t.column : CodeMirror.Pass;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"atom");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"variable");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"fun");      // f/0 style fun
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"builtin");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return rval(state,stream,"attribute");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"comment");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return rval(state,stream,"macro");
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

          return rval(state,stream,"fun");      // 'f'/0 style fun
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return t.column;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js - About 30 mins to fix

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

    if (ch == "#") {
      stream.eatSpace();
      stream.eatWhile(anumRE);
      return rval(state,stream,"record");
    }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js on lines 145..149

Duplicated Code

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

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

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

Tuning

This issue has a mass of 45.

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

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

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

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

Refactorings

Further Reading

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

    if (ch == '?') {
      stream.eatSpace();
      stream.eatWhile(anumRE);
      return rval(state,stream,"macro");
    }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/erlang/erlang.js on lines 152..156

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