SiLeBAT/FSK-Lab

View on GitHub
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/twig/twig.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/twig/twig.js - About 3 hrs 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/twig/twig.js - About 45 mins 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/twig/twig.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/twig/twig.js - About 45 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/twig/twig.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/twig/twig.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/twig/twig.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/twig/twig.js - About 30 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/twig/twig.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/twig/twig.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/twig/twig.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/twig/twig.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/twig/twig.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/twig/twig.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/twig/twig.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/jinja2/jinja2.js on lines 36..131

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 11 locations. Consider refactoring.
Open

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"),  require("../../addon/mode/multiplex"));
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror", "../../addon/mode/multiplex"], mod);
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/dart/dart.js on lines 4..166
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/dockerfile/dockerfile.js on lines 4..211
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/factor/factor.js on lines 8..85
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/haskell-literate/haskell-literate.js on lines 4..43
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/nsis/nsis.js on lines 6..95
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/pegjs/pegjs.js on lines 4..114
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rust/rust.js on lines 4..72
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/sass/sass.js on lines 4..454
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/soy/soy.js on lines 4..437
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/yaml-frontmatter/yaml-frontmatter.js on lines 4..68

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

    var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"],
Severity: Minor
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/twig/twig.js and 1 other location - About 35 mins to fix
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/css/css.js on lines 435..446

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

There are no issues that match your filters.

Category
Status