CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js

Summary

Maintainability
F
5 days
Test Coverage

File plugin.js has 829 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Compiled inline version. (Library mode)
 */

/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */

    Function WordFilter has 233 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function WordFilter(editor) {
            var settings = editor.settings;
    
            editor.on('BeforePastePreProcess', function(e) {
                var content = e.content, retainStyleProperties, validStyles;

      Function registerEventHandlers has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function registerEventHandlers() {
                  editor.on('keydown', function(e) {
                      if (e.isDefaultPrevented()) {
                          return;
                      }

        Function convertFakeListsToProperLists has 63 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    function convertFakeListsToProperLists(node) {
                        var currentListNode, prevListNode, lastLevel = 1;
        
                        function convertParagraphToLi(paragraphNode, listStartTextNode, listName, start) {
                            var level = paragraphNode._listLevel || lastLevel;

          Function filterStyles has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      function filterStyles(node, styleValue) {
                          var outputStyles = {}, styles = editor.dom.parseStyle(styleValue);
          
                          // Parse out list indent level for lists
                          if (node.name === 'p') {

            Function createPasteBin has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function createPasteBin() {
                        var dom = editor.dom, body = editor.getBody();
                        var viewport = editor.dom.getViewPort(editor.getWin()), scrollTop = viewport.y, top = 20;
                        var scrollContainer;
            
            

              Function innerText has 36 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function innerText(html) {
                      var schema = new Schema(), domParser = new DomParser({}, schema), text = '';
                      var shortEndedElements = schema.getShortEndedElements();
                      var ignoreElements = Tools.makeMap('script noscript style textarea video audio iframe object', ' ');
                      var blockElements = schema.getBlockElements();

                Function convertParagraphToLi has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                                function convertParagraphToLi(paragraphNode, listStartTextNode, listName, start) {
                                    var level = paragraphNode._listLevel || lastLevel;
                
                                    // Handle list nesting
                                    if (level != lastLevel) {

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

                          function walk(node) {
                              var name = node.name, currentNode = node;
                  
                              if (name === 'br') {
                                  text += '\n';

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

                            function removeWebKitStyles(content) {
                                // Passthrough all styles from Word and let the WordFilter handle that junk
                                if (WordFilter.isWordContent(content)) {
                                    return content;
                                }

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

                                      if (/(bold)/i.test(outputStyles["font-weight"])) {
                                          delete outputStyles["font-weight"];
                                          node.wrap(new Node("b", 1));
                                      }
                      Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js on lines 899..902

                      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

                                      if (/(italic)/i.test(outputStyles["font-style"])) {
                                          delete outputStyles["font-style"];
                                          node.wrap(new Node("i", 1));
                                      }
                      Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js on lines 893..896

                      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

                              if (settings.paste_preprocess) {
                                  editor.on('PastePreProcess', function(e) {
                                      settings.paste_preprocess.call(self, self, e);
                                  });
                              }
                      Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js on lines 1295..1299

                      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

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

                              if (settings.paste_postprocess) {
                                  editor.on('PastePostProcess', function(e) {
                                      settings.paste_postprocess.call(self, self, e);
                                  });
                              }
                      Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/paste/plugin.js on lines 1289..1293

                      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