insideout10/wordlift-plugin-js

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

Summary

Maintainability
F
6 days
Test Coverage

Function moveStates has 215 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        moveStates : function(to_form, field) {
            var data = this.data, editor = this.editor,
                mediaPlugin = editor.plugins.media, ext, src, typeInfo, defaultStates, src;

            defaultStates = {
Severity: Major
Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 1 day to fix

    File media.js has 397 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function() {
        var url;
    
        if (url = tinyMCEPopup.getParam("media_external_list_url"))
            document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
    Severity: Minor
    Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 5 hrs to fix

      Function setOptions has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function setOptions(type, names) {
                      var i, name, formItemName, value, list;
      
                      if (type == data.type || type == 'global') {
                          names = tinymce.explode(names);
      Severity: Minor
      Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 1 hr to fix

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

                init : function() {
                    var html, editor, self = this;
        
                    self.editor = editor = tinyMCEPopup.editor;
        
        Severity: Minor
        Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 1 hr to fix

          Avoid deeply nested control flow statements.
          Open

                                          if ((type == 'video' || type == 'audio') && value === true)
                                              value = name;
          Severity: Major
          Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                            if (defaultStates[formItemName]) {
                                                if (value !== defaultStates[formItemName]) {
                                                    value = "" + value;
                                                    list[name] = value;
                                                }
            Severity: Major
            Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (value == '$url')
                                              data.params.src = parseQueryParams(data.params.flashvars)[name] || data.params.src || '';
              Severity: Major
              Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js - About 45 mins to fix

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

                                } else if (data.type == 'audio') {
                                    if (!data.video.sources)
                                        data.video.sources = [];
                                    
                                    data.video.sources[0] = {src : src};
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 5 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 373..400

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

                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 == 'video') {
                                    if (!data.video.sources)
                                        data.video.sources = [];
                
                                    data.video.sources[0] = {src : src};
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 5 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 386..400

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

                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 == 'video') {
                                    if (data.video.sources[0])
                                        setVal('src', data.video.sources[0].src);
                
                                    src = data.video.sources[1];
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 3 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 273..294

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

                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 (data.type == 'audio') {
                                    if (data.video.sources[0])
                                        setVal('src', data.video.sources[0].src);
                                    
                                    src = data.video.sources[1];
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 3 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 262..294

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

                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 (src.match(/vimeo\.com\/([0-9]+)/)) {
                                    data.width = 425;
                                    data.height = 350;
                                    data.params.frameborder = '0';
                                    data.type = 'iframe';
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 2 other locations - About 3 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 308..316
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 352..360

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

                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 (src.match(/youtu\.be\/[a-z1-9.-_]+/)) {
                                        data.width = 425;
                                        data.height = 350;
                                        data.params.frameborder = '0';
                                        data.type = 'iframe';
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 2 other locations - About 3 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 341..349
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 352..360

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

                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 (src.match(/stream\.cz\/((?!object).)*\/([0-9]+)/)) {
                                    data.width = 425;
                                    data.height = 350;
                                    data.params.frameborder = '0';
                                    data.type = 'iframe';
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 2 other locations - About 3 hrs to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 308..316
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 341..349

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

                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

                                for (var i=0; i<tinyMCEMediaList.length; i++)
                                    html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
                Severity: Major
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 1 hr to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/advlink/js/advlink.js on lines 503..504

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

                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 {
                                    this.width = Math.round((height / this.height) * width);
                                    setVal('width', this.width);
                                }
                Severity: Minor
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 35 mins to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 444..447

                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 (type == 'width') {
                                    this.height = Math.round((width / this.width) * height);
                                    setVal('height', this.height);
                                } else {
                Severity: Minor
                Found in app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js and 1 other location - About 35 mins to fix
                app/lib/tinymce/jscripts/tiny_mce/plugins/media/js/media.js on lines 447..450

                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