krafthaus/bauhaus

View on GitHub
bower_components/tinymce/plugins/media/plugin.js

Summary

Maintainability
F
4 days
Test Coverage

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

/**
 * plugin.js
 *
 * Copyright, Moxiecode Systems AB
 * Released under LGPL License.
Severity: Major
Found in bower_components/tinymce/plugins/media/plugin.js - About 1 day to fix

    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) {
    Severity: Major
    Found in bower_components/tinymce/plugins/media/plugin.js - About 5 hrs to fix

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

          function showDialog() {
              var win, width, height, data;
      
              var generalFormItems = [
                  {
      Severity: Major
      Found in bower_components/tinymce/plugins/media/plugin.js - About 4 hrs to fix

        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));
        Severity: Major
        Found in bower_components/tinymce/plugins/media/plugin.js - About 3 hrs to fix

          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":
          Severity: Major
          Found in bower_components/tinymce/plugins/media/plugin.js - About 2 hrs to fix

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

                function htmlToData(html) {
                    var data = {};
            
                    new tinymce.html.SaxParser({
                        validate: false,
            Severity: Minor
            Found in bower_components/tinymce/plugins/media/plugin.js - About 1 hr to fix

              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;
                              }
              
              
              Severity: Minor
              Found in bower_components/tinymce/plugins/media/plugin.js - About 1 hr to fix

                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 = [];
                Severity: Minor
                Found in bower_components/tinymce/plugins/media/plugin.js - About 1 hr 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 bower_components/tinymce/plugins/media/plugin.js - About 45 mins to fix

                    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 bower_components/tinymce/plugins/media/plugin.js - About 45 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return 'video/ogg';
                      Severity: Major
                      Found in bower_components/tinymce/plugins/media/plugin.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return '';
                        Severity: Major
                        Found in bower_components/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 bower_components/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'});
                                    }
                            Severity: Major
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 1 hr to fix
                            bower_components/tinymce/plugins/media/plugin.js on lines 107..109

                            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'});
                                    }
                            Severity: Major
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 1 hr to fix
                            bower_components/tinymce/plugins/media/plugin.js on lines 111..113

                            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

                                                    '<audio controls="controls" src="' + data.source1 + '">' +
                                                        (data.source2 ? '\n<source src="' + data.source2 + '"' + (data.source2mime ? ' type="' + data.source2mime + '"' : '') + ' />\n' : '') +
                            Severity: Minor
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 55 mins to fix
                            bower_components/tinymce/plugins/media/plugin.js on lines 308..310

                            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

                                                    '<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' : '') +
                            Severity: Minor
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 55 mins to fix
                            bower_components/tinymce/plugins/media/plugin.js on lines 296..297

                            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

                                        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">';
                            
                            
                            Severity: Minor
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 35 mins to fix
                            bower_components/tinymce/plugins/media/plugin.js on lines 286..288

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

                                            if (data.poster) {
                                                html += '<img src="' + data.poster + '" width="' + data.width + '" height="' + data.height + '" />';
                                            }
                            Severity: Minor
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 35 mins to fix
                            bower_components/tinymce/plugins/media/plugin.js on lines 281..314

                            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

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

                                                tinymce.each(e.meta, function(value, key) {
                                                    win.find('#' + key).value(value);
                                                });
                            Severity: Minor
                            Found in bower_components/tinymce/plugins/media/plugin.js and 1 other location - About 35 mins to fix
                            bower_components/tinymce/plugins/link/plugin.js on lines 114..116

                            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