insideout10/wordlift-plugin-js

View on GitHub
app/lib/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js

Summary

Maintainability
F
5 days
Test Coverage

Function handleContentEditableSelection has 292 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function handleContentEditableSelection(ed) {
        var dom = ed.dom, selection = ed.selection, invisibleChar, caretContainerId = 'mce_noneditablecaret', invisibleChar = '\uFEFF';

        // Returns the content editable state of a node "true/false" or null
        function getContentEditable(node) {

    File editor_plugin_src.js has 378 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * editor_plugin_src.js
     *
     * Copyright 2009, Moxiecode Systems AB
     * Released under LGPL License.

      Function handleKey has 124 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function handleKey(ed, e) {
                  var keyCode = e.keyCode, nonEditableParent, caretContainer, startElement, endElement;
      
                  function getNonEmptyTextNodeSibling(node, prev) {
                      while (node = node[prev ? 'previousSibling' : 'nextSibling']) {

        Function init has 65 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                init : function(ed, url) {
                    var editClass, nonEditClass, nonEditableRegExps;
        
                    // Converts configured regexps to noneditable span items
                    function convertRegExpsToNonEditable(ed, args) {

          Function moveSelection has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function moveSelection() {
                      var nonEditableStart, nonEditableEnd, isCollapsed, rng, element;
          
                      // Checks if there is any contents to the left/right side of caret returns the noneditable element or any editable element if it finds one inside
                      function hasSideContent(element, left) {

            Function canDelete has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        function canDelete(backspace) {
                            var rng, container, offset, nonEditableParent;
            
                            function removeNodeIfNotParent(node) {
                                var parent = container;

              Function hasSideContent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                          function hasSideContent(element, left) {
                              var container, offset, walker, node, len;
              
                              container = rng.startContainer;
                              offset = rng.startOffset;

                Avoid deeply nested control flow statements.
                Open

                                            if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
                                                e.preventDefault();
                
                                                if (keyCode == VK.RIGHT) {
                                                    positionCaretOnElement(nonEditableParent, false);

                  Avoid deeply nested control flow statements.
                  Open

                                              if (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
                                                  e.preventDefault();
                  
                                                  if (keyCode == VK.LEFT) {
                                                      positionCaretOnElement(nonEditableParent, true);

                    Avoid too many return statements within this function.
                    Open

                                    return element;

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

                              function findFirstTextNode(node) {
                                  var walker;
                      
                                  if (node) {
                                      walker = new TreeWalker(node, node);
                      app/lib/tinymce/jscripts/tiny_mce/tiny_mce_src.js on lines 18211..18223

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

                      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 (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
                                                      e.preventDefault();
                      
                                                      if (keyCode == VK.RIGHT) {
                                                          positionCaretOnElement(nonEditableParent, false);
                      app/lib/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js on lines 375..386

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

                      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 (nonEditableParent && getContentEditable(nonEditableParent) === "false") {
                                                      e.preventDefault();
                      
                                                      if (keyCode == VK.LEFT) {
                                                          positionCaretOnElement(nonEditableParent, true);
                      app/lib/tinymce/jscripts/tiny_mce/plugins/noneditable/editor_plugin_src.js on lines 393..404

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

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

                              getInfo : function() {
                                  return {
                                      longname : 'Non editable elements',
                                      author : 'Moxiecode Systems AB',
                                      authorurl : 'http://tinymce.moxiecode.com',
                      app/lib/tinymce/jscripts/tiny_mce/plugins/advhr/editor_plugin_src.js on lines 44..52
                      app/lib/tinymce/jscripts/tiny_mce/plugins/advimage/editor_plugin_src.js on lines 37..45
                      app/lib/tinymce/jscripts/tiny_mce/plugins/advlink/editor_plugin_src.js on lines 48..56
                      app/lib/tinymce/jscripts/tiny_mce/plugins/advlist/editor_plugin_src.js on lines 163..171
                      app/lib/tinymce/jscripts/tiny_mce/plugins/bbcode/editor_plugin_src.js on lines 29..37
                      app/lib/tinymce/jscripts/tiny_mce/plugins/directionality/editor_plugin_src.js on lines 53..61
                      app/lib/tinymce/jscripts/tiny_mce/plugins/emotions/editor_plugin_src.js on lines 30..38
                      app/lib/tinymce/jscripts/tiny_mce/plugins/fullpage/editor_plugin_src.js on lines 40..48
                      app/lib/tinymce/jscripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js on lines 221..229
                      app/lib/tinymce/jscripts/tiny_mce/plugins/iespell/editor_plugin_src.js on lines 41..49
                      app/lib/tinymce/jscripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js on lines 23..31
                      app/lib/tinymce/jscripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js on lines 34..42
                      app/lib/tinymce/jscripts/tiny_mce/plugins/layer/editor_plugin_src.js on lines 89..97
                      app/lib/tinymce/jscripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js on lines 126..134
                      app/lib/tinymce/jscripts/tiny_mce/plugins/lists/editor_plugin_src.js on lines 944..952
                      app/lib/tinymce/jscripts/tiny_mce/plugins/media/editor_plugin_src.js on lines 223..231
                      app/lib/tinymce/jscripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js on lines 61..69
                      app/lib/tinymce/jscripts/tiny_mce/plugins/paste/editor_plugin_src.js on lines 328..336
                      app/lib/tinymce/jscripts/tiny_mce/plugins/preview/editor_plugin_src.js on lines 40..48
                      app/lib/tinymce/jscripts/tiny_mce/plugins/print/editor_plugin_src.js on lines 21..29
                      app/lib/tinymce/jscripts/tiny_mce/plugins/save/editor_plugin_src.js on lines 30..38
                      app/lib/tinymce/jscripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js on lines 48..56
                      app/lib/tinymce/jscripts/tiny_mce/plugins/style/editor_plugin_src.js on lines 58..66
                      app/lib/tinymce/jscripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js on lines 109..117
                      app/lib/tinymce/jscripts/tiny_mce/plugins/template/editor_plugin_src.js on lines 53..61
                      app/lib/tinymce/jscripts/tiny_mce/plugins/visualblocks/editor_plugin_src.js on lines 50..58
                      app/lib/tinymce/jscripts/tiny_mce/plugins/visualchars/editor_plugin_src.js on lines 32..40
                      app/lib/tinymce/jscripts/tiny_mce/plugins/wordcount/editor_plugin_src.js on lines 110..118
                      app/lib/tinymce/jscripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js on lines 119..127

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

                      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 (container.nodeType == 3 && (backspace ? offset > 0 : offset < container.nodeValue.length)) {
                                              return true;
                                          }
                      app/lib/tinymce/jscripts/tiny_mce/tiny_mce_src.js on lines 18728..18730

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

                      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

                              function getParentCaretContainer(node) {
                                  while (node) {
                                      if (node.id === caretContainerId) {
                                          return node;
                                      }
                      app/lib/tinymce/jscripts/tiny_mce/tiny_mce_src.js on lines 18200..18208

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

                      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