Semantic-Org/Semantic-UI

View on GitHub
examples/assets/library/iframe-content.js

Summary

Maintainability
F
4 days
Test Coverage

File iframe-content.js has 871 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * File: iframeResizer.contentWindow.js
 * Desc: Include this file in any page being loaded into an iframe
 *       to force the iframe to resize to the content size.
 * Requires: iframeResizer.js on host page.
Severity: Major
Found in examples/assets/library/iframe-content.js - About 2 days to fix

    Function receiver has 79 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function receiver(event) {
        var processRequestFromParent = {
          init: function initFromParent() {
            function fireInit() {
              initMsg = event.data;
    Severity: Major
    Found in examples/assets/library/iframe-content.js - About 3 hrs to fix

      Function setupInPageLinks has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function setupInPageLinks() {
      
          function getPagePosition () {
            return {
              x: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,
      Severity: Major
      Found in examples/assets/library/iframe-content.js - About 2 hrs to fix

        Function setupBodyMutationObserver has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function setupBodyMutationObserver() {
            function addImageLoadListners(mutation) {
              function addImageLoadListener(element) {
                if (false === element.complete) {
                  log('Attach listeners to ' + element.src);
        Severity: Major
        Found in examples/assets/library/iframe-content.js - About 2 hrs to fix

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

            function setupPublicMethods() {
              log('Enable public methods');
          
              win.parentIFrame = {
          
          
          Severity: Major
          Found in examples/assets/library/iframe-content.js - About 2 hrs to fix

            Function sizeIFrame has 37 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function sizeIFrame(triggerEvent, triggerEventDesc, customHeight, customWidth) {
            
                function resizeIFrame() {
                  height = currentHeight;
                  width  = currentWidth;
            Severity: Minor
            Found in examples/assets/library/iframe-content.js - About 1 hr to fix

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

                function throttle(func) {
                  var
                    context, args, result,
                    timeout = null,
                    previous = 0,
              Severity: Minor
              Found in examples/assets/library/iframe-content.js - About 1 hr to fix

                Function sendMsg has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  function sendMsg(height,width,triggerEvent,msg,targetOrigin) {
                Severity: Minor
                Found in examples/assets/library/iframe-content.js - About 35 mins to fix

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

                    function addEventListener(el,evt,func) {
                      /* istanbul ignore else */ // Not testable in phantonJS
                      if ('addEventListener' in window) {
                        el.addEventListener(evt,func, false);
                      } else if ('attachEvent' in window) { //IE
                  Severity: Major
                  Found in examples/assets/library/iframe-content.js and 3 other locations - About 1 hr to fix
                  examples/assets/library/iframe-content.js on lines 81..88
                  examples/assets/library/iframe.js on lines 63..70
                  examples/assets/library/iframe.js on lines 72..79

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

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

                    function removeEventListener(el,evt,func) {
                      /* istanbul ignore else */ // Not testable in phantonJS
                      if ('removeEventListener' in window) {
                        el.removeEventListener(evt,func, false);
                      } else if ('detachEvent' in window) { //IE
                  Severity: Major
                  Found in examples/assets/library/iframe-content.js and 3 other locations - About 1 hr to fix
                  examples/assets/library/iframe-content.js on lines 72..79
                  examples/assets/library/iframe.js on lines 63..70
                  examples/assets/library/iframe.js on lines 72..79

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

                  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

                        return {
                          x: (window.pageXOffset !== undefined) ? window.pageXOffset : document.documentElement.scrollLeft,
                          y: (window.pageYOffset !== undefined) ? window.pageYOffset : document.documentElement.scrollTop
                        };
                  Severity: Major
                  Found in examples/assets/library/iframe-content.js and 1 other location - About 1 hr to fix
                  examples/assets/library/iframe.js on lines 561..564

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

                  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

                        message: function messageFromParent() {
                          var msgBody = getData();
                  
                          log('MessageCallback called from parent: ' + msgBody );
                          messageCallback(JSON.parse(msgBody));
                  Severity: Minor
                  Found in examples/assets/library/iframe-content.js and 1 other location - About 50 mins to fix
                  examples/assets/library/iframe-content.js on lines 1034..1039

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

                  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

                        pageInfo: function pageInfoFromParent() {
                          var msgBody = getData();
                          log('PageInfoFromParent called from parent: ' + msgBody );
                          pageInfoCallback(JSON.parse(msgBody));
                          log(' --');
                  Severity: Minor
                  Found in examples/assets/library/iframe-content.js and 1 other location - About 50 mins to fix
                  examples/assets/library/iframe-content.js on lines 1041..1047

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

                  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