SiLeBAT/FSK-Lab

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

Summary

Maintainability
F
3 days
Test Coverage

Function to_normal has 182 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function to_normal(stream, state) {
    var token = null;

    if (stream.sol() && stream.match(rx_examples, false)) {
      change(state, to_mode, {
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js - About 7 hrs to fix

File rst.js has 455 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
Severity: Minor
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js - About 6 hrs to fix

Function to_explicit has 93 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function to_explicit(stream, state) {
    var token = null;

    if (phase(state) == rx_substitution ||
        stream.match(rx_substitution, false)) {
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js - About 3 hrs to fix

Avoid deeply nested control flow statements.
Open

    } else if (stream.match(rx_footnote_ref)) {
      change(state, to_normal);
      token = 'quote';
    } else if (stream.match(rx_citation_ref)) {
      change(state, to_normal);
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      if (stream.eol()) {
        change(state, to_normal);
      } else {
        stream.skipToEnd();
        change(state, to_comment);
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js - About 45 mins to fix

Avoid deeply nested control flow statements.
Open

      switch (stage(state)) {
      case 0:
        change(state, to_normal, context(rx_substitution_ref, 1));
        stream.match(rx_substitution_text);
        token = 'variable-2';
Severity: Major
Found in de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js - About 45 mins to fix

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

Avoid too many return statements within this function.
Open

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

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

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay"));
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod);
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/htmlmixed/htmlmixed.js on lines 4..152
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/pug/pug.js on lines 4..591

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

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 (stream.match(/^latex\s*$/) || state.tmp_stex) {
          state.tmp_stex = undefined; change(state, to_mode, {
            mode: mode_stex, local: CodeMirror.startState(mode_stex)
          });
        }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js on lines 412..416

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

        if (stream.match(/^python\s*$/) || state.tmp_py) {
          state.tmp_py = undefined; change(state, to_mode, {
            mode: mode_python, local: CodeMirror.startState(mode_python)
          });
        }
de.bund.bfr.knime.js/js-lib/codemirror-5.49.2/mode/rst/rst.js on lines 404..408

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

There are no issues that match your filters.

Category
Status