SiLeBAT/FSK-Lab

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

Summary

Maintainability
F
6 days
Test Coverage

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

    function tokenBase (stream, state) {
      var ch = stream.peek();

      //Comment
      if (state.incomment) {
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.js - About 3 hrs to fix

Avoid deeply nested control flow statements.
Open

        } else if (ch = stream.eat(/\{|%/)) {
          //Cache close tag
          state.intag = ch;
          if(ch == "{") {
            state.intag = "}";
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if(!stream.skipTo("#}")) {
            stream.skipToEnd();
          } else {
            stream.eatWhile(/\#|}/);
            state.incomment = false;
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

          if(stream.eat(" ") || stream.sol()) {
            if(stream.match(keywords)) {
              return "keyword";
            }
            if(stream.match(atom)) {
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.js - About 45 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

          return "operator";
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.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.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

            return "number";
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.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.js/js-lib/codemirror-5.49.2/mode/jinja2/jinja2.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

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

    function tokenBase (stream, state) {
      var ch = stream.peek();

      //Comment
      if (state.incomment) {
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/twig/twig.js on lines 24..119

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

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

    var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
      "extends", "filter", "endfilter", "firstof", "for",
      "endfor", "if", "endif", "ifchanged", "endifchanged",
      "ifequal", "endifequal", "ifnotequal",
      "endifnotequal", "in", "include", "load", "not", "now", "or",
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/django/django.js on lines 25..37
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/tornado/tornado.js on lines 17..22

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

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

    return {
      startState: function () {
        return {tokenize: tokenBase};
      },
      token: function (stream, state) {
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/django/django.js on lines 337..346

Duplicated Code

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

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

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

Tuning

This issue has a mass of 57.

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

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

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

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

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status