CaffGeek/MBACNationals

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

Summary

Maintainability
F
4 days
Test Coverage

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

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

    Function updateHtml has 125 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function updateHtml(html, data, updateAll) {
            var writer = new tinymce.html.Writer();
            var sourceCount = 0, hasImage;
    
            function setAttributes(attrs, updatedAttrs) {

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

          function showDialog() {
              var win, width, height, data;
              var generalFormItems = [
                  {name: 'source1', type: 'filepicker', filetype: 'media', size: 40, autofocus: true, label: 'Source'}
              ];

        Function dataToHtml has 82 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function dataToHtml(data) {
                var html = '';
        
                if (!data.source1) {
                    tinymce.extend(data, htmlToData(data.embed));

          Function start has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                      start: function(name, attrs, empty) {
                          switch (name) {
                              case "video":
                              case "object":
                              case "embed":

            Function htmlToData has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function htmlToData(html) {
                    var data = {};
            
                    new tinymce.html.SaxParser({
                        validate: false,

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

                          start: function(name, attrs) {
                              if (!data.source1 && name == "param") {
                                  data.source1 = attrs.map.movie;
                              }
              
              

                Function end has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            end: function(name) {
                                if (name == "video" && updateAll) {
                                    for (var index = 1; index <= 2; index++) {
                                        if (data["source" + index]) {
                                            var attrs = [];

                  Avoid deeply nested control flow statements.
                  Open

                                              if (value) {
                                                  attrs.map[name] = value;
                                                  attr.value = value;
                                              } else {
                                                  delete attrs.map[name];
                  Severity: Major
                  Found in Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                    if (editor.settings.video_template_callback) {
                                        html = editor.settings.video_template_callback(data);
                                    } else {
                                        html = (
                                            '<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
                    Severity: Major
                    Found in Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js - About 45 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return '';
                      Severity: Major
                      Found in Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return 'application/x-shockwave-flash';
                        Severity: Major
                        Found in Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return 'video/ogg';
                          Severity: Major
                          Found in Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js - About 30 mins to fix

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

                                    if (editor.settings.media_poster !== false) {
                                        generalFormItems.push({name: 'poster', type: 'filepicker', filetype: 'image', size: 40, label: 'Poster'});
                                    }
                            Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js on lines 92..94

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

                            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 (editor.settings.media_alt_source !== false) {
                                        generalFormItems.push({name: 'source2', type: 'filepicker', filetype: 'media', size: 40, label: 'Alternative source'});
                                    }
                            Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js on lines 96..98

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

                            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

                                                    '<video width="' + data.width + '" height="' + data.height + '"' + (data.poster ? ' poster="' + data.poster + '"' : '') + ' controls="controls">\n' +
                                                        '<source src="' + data.source1 + '"' + (data.source1mime ? ' type="' + data.source1mime + '"' : '') + ' />\n' +
                                                        (data.source2 ? '<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
                            Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js on lines 256..257

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

                            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

                                                    '<audio controls="controls" src="' + data.source1 + '">' +
                                                        (data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
                            Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js on lines 268..270

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

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

                                        if (data.type == "iframe") {
                                            html += '<iframe src="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '"></iframe>';
                                        } else if (data.source1mime == "application/x-shockwave-flash") {
                                            html += '<object data="' + data.source1 + '" width="' + data.width + '" height="' + data.height + '" type="application/x-shockwave-flash">';
                            
                            
                            Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js on lines 246..248
                            Web.Admin/z-scripts/ai.0.15.0-build46802.js on lines 285..287

                            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

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

                                            if (data.poster) {
                                                html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
                                            }
                            Web.Admin/2014/wordpress/wp-includes/js/tinymce/plugins/media/plugin.js on lines 241..274
                            Web.Admin/z-scripts/ai.0.15.0-build46802.js on lines 285..287

                            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