webcol/Calima

View on GitHub
public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js

Summary

Maintainability
F
6 days
Test Coverage

File markdown.js has 615 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function(mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS

    Function inlineNormal has 168 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function inlineNormal(stream, state) {
        var style = state.text(stream, state);
        if (typeof style !== 'undefined')
          return style;
    
    

      Function blockNormal has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function blockNormal(stream, state) {
      
          var sol = stream.sol();
      
          var prevLineIsList = (state.list !== false);

        Function getType has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function getType(state) {
            var styles = [];
        
            if (state.formatting) {
              styles.push(formatting);

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

              token: function(stream, state) {
          
                // Reset state.formatting
                state.formatting = false;
          
          

            Avoid deeply nested control flow statements.
            Open

                } else if (modeCfg.fencedCodeBlocks && stream.match(/^```([\w+#]*)/, true)) {
                  // try switching mode
                  state.localMode = getMode(RegExp.$1);
                  if (state.localMode) state.localState = state.localMode.startState();
                  switchBlock(stream, state, local);

              Avoid deeply nested control flow statements.
              Open

                    if (modeCfg.taskLists && stream.match(taskListRE, false)) {
                      state.taskList = true;
                    }

                Avoid deeply nested control flow statements.
                Open

                      if (stream.match(ulRE, true)) {
                        listType = 'ul';
                      } else {
                        stream.match(olRE, true);
                        listType = 'ol';

                  Avoid deeply nested control flow statements.
                  Open

                          if (modeCfg.highlightFormatting) state.formatting = "em";

                    Avoid deeply nested control flow statements.
                    Open

                          if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];

                      Avoid deeply nested control flow statements.
                      Open

                            } else if (!state.em) { // Add EM
                              state.em = ch;
                              if (modeCfg.highlightFormatting) state.formatting = "em";
                              return getType(state);
                            }

                        Avoid too many return statements within this function.
                        Open

                                  return getType(state);

                          Avoid too many return statements within this function.
                          Open

                                return type;

                            Avoid too many return statements within this function.
                            Open

                                    return getType(state);

                              Avoid too many return statements within this function.
                              Open

                                    return type + linkinline;

                                Avoid too many return statements within this function.
                                Open

                                    return getType(state);

                                  Avoid too many return statements within this function.
                                  Open

                                        return switchInline(stream, state, footnoteLink);

                                    Avoid too many return statements within this function.
                                    Open

                                          return getType(state);

                                      Avoid too many return statements within this function.
                                      Open

                                              return type ? type + " formatting-escape" : "formatting-escape";

                                        Avoid too many return statements within this function.
                                        Open

                                              return type + linkemail;

                                          Avoid too many return statements within this function.
                                          Open

                                              return switchInline(stream, state, state.inline);

                                            Avoid too many return statements within this function.
                                            Open

                                                    return getType(state);

                                              Avoid too many return statements within this function.
                                              Open

                                                    return getType(state);

                                                Avoid too many return statements within this function.
                                                Open

                                                      return switchBlock(stream, state, htmlBlock);

                                                  Avoid too many return statements within this function.
                                                  Open

                                                          return getType(state);

                                                    Avoid too many return statements within this function.
                                                    Open

                                                          return getType(state);

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return t;

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return getType(state);

                                                          Avoid too many return statements within this function.
                                                          Open

                                                                  return t;

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                  return getType(state);

                                                              Avoid too many return statements within this function.
                                                              Open

                                                                    return getType(state);

                                                                Avoid too many return statements within this function.
                                                                Open

                                                                      return hr;

                                                                  Avoid too many return statements within this function.
                                                                  Open

                                                                        return image;

                                                                    Avoid too many return statements within this function.
                                                                    Open

                                                                          return "tag";

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                              return linkhref;

                                                                        Avoid too many return statements within this function.
                                                                        Open

                                                                                  return t;

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

                                                                              if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
                                                                                state.f = state.inline = linkInline;
                                                                                if (modeCfg.highlightFormatting) state.formatting = "link";
                                                                                var type = getType(state);
                                                                                if (type){
                                                                          public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js on lines 429..439

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

                                                                          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.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
                                                                                state.f = state.inline = linkInline;
                                                                                if (modeCfg.highlightFormatting) state.formatting = "link";
                                                                                var type = getType(state);
                                                                                if (type){
                                                                          public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js on lines 441..451

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

                                                                          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 === endChar) {
                                                                                  state.f = state.inline = inlineNormal;
                                                                                  if (modeCfg.highlightFormatting) state.formatting = "link-string";
                                                                                  var returnState = getType(state);
                                                                                  state.linkHref = false;
                                                                          public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js on lines 593..599

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

                                                                          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(/^\]:/, true)) {
                                                                                state.f = state.inline = footnoteUrl;
                                                                                if (modeCfg.highlightFormatting) state.formatting = "link";
                                                                                var returnType = getType(state);
                                                                                state.linkText = false;
                                                                          public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js on lines 564..570

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

                                                                          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

                                                                                } else if (state.em === ch) { // Remove EM
                                                                                  if (modeCfg.highlightFormatting) state.formatting = "em";
                                                                                  var t = getType(state);
                                                                                  state.em = false;
                                                                                  return t;
                                                                          public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js on lines 485..503

                                                                          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

                                                                                } else if (state.strong === ch && stream.eat(ch)) { // Remove STRONG
                                                                                  if (modeCfg.highlightFormatting) state.formatting = "strong";
                                                                                  var t = getType(state);
                                                                                  state.strong = false;
                                                                                  return t;
                                                                          public_/plantillas/inspinia/js/plugins/codemirror/mode/markdown/markdown.js on lines 494..503

                                                                          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

                                                                          There are no issues that match your filters.

                                                                          Category
                                                                          Status