concord-consortium/lara

View on GitHub
public/demo-interactives/iframe-phone.js

Summary

Maintainability
F
2 wks
Test Coverage

Function 1 has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

!function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.iframePhone=e():"undefined"!=typeof global?global.iframePhone=e():"undefined"!=typeof self&&(self.iframePhone=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var structuredClone = require('./structured-clone');
var HELLO_INTERVAL_LENGTH = 200;
var HELLO_TIMEOUT_LENGTH = 60000;

Severity: Major
Found in public/demo-interactives/iframe-phone.js - About 4 hrs to fix

    Function 3 has 102 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    },{"./iframe-endpoint":1,"./parent-endpoint":3}],3:[function(require,module,exports){
    var structuredClone = require('./structured-clone');
    
    /**
      Call as:
    Severity: Major
    Found in public/demo-interactives/iframe-phone.js - About 4 hrs to fix

      Function ParentEndpoint has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function ParentEndpoint(targetWindowOrIframeEl, targetOrigin, afterConnectedCallback) {
        var postMessageQueue = [];
        var connected = false;
        var handlers = {};
        var targetWindowIsIframeElement;
      Severity: Major
      Found in public/demo-interactives/iframe-phone.js - About 3 hrs to fix

        Function IFrameEndpoint has 91 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function IFrameEndpoint() {
          var listeners = {};
          var isInitialized = false;
          var connected = false;
          var postMessageQueue = [];
        Severity: Major
        Found in public/demo-interactives/iframe-phone.js - About 3 hrs to fix

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

          !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.iframePhone=e():"undefined"!=typeof global?global.iframePhone=e():"undefined"!=typeof self&&(self.iframePhone=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
          var structuredClone = require('./structured-clone');
          var HELLO_INTERVAL_LENGTH = 200;
          var HELLO_TIMEOUT_LENGTH = 60000;
          
          
          Severity: Minor
          Found in public/demo-interactives/iframe-phone.js - About 3 hrs to fix

            Function 2 has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            },{"./structured-clone":4}],2:[function(require,module,exports){
            var ParentEndpoint = require('./parent-endpoint');
            var getIFrameEndpoint = require('./iframe-endpoint');
            
            // Not a real UUID as there's an RFC for that (needed for proper distributed computing).
            Severity: Major
            Found in public/demo-interactives/iframe-phone.js - About 2 hrs to fix

              Function IframePhoneRpcEndpoint has 59 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function IframePhoneRpcEndpoint(handler, namespace, targetWindow, targetOrigin, phone) {
                var pendingCallbacks = Object.create({});
              
                // if it's a non-null object, rather than a function, 'handler' is really an options object
                if (handler && typeof handler === 'object') {
              Severity: Major
              Found in public/demo-interactives/iframe-phone.js - About 2 hrs to fix

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

                module.exports = function IframePhoneRpcEndpoint(handler, namespace, targetWindow, targetOrigin, phone) {
                Severity: Minor
                Found in public/demo-interactives/iframe-phone.js - About 35 mins to fix

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

                  },{"./structured-clone":4}],2:[function(require,module,exports){
                  var ParentEndpoint = require('./parent-endpoint');
                  var getIFrameEndpoint = require('./iframe-endpoint');
                  
                  // Not a real UUID as there's an RFC for that (needed for proper distributed computing).
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 4 days to fix
                  app/assets/javascripts/iframe-phone.js on lines 153..243

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

                  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

                  !function(e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):"undefined"!=typeof window?window.iframePhone=e():"undefined"!=typeof global?global.iframePhone=e():"undefined"!=typeof self&&(self.iframePhone=e())}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
                  var structuredClone = require('./structured-clone');
                  var HELLO_INTERVAL_LENGTH = 200;
                  var HELLO_TIMEOUT_LENGTH = 60000;
                  
                  
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 1 day to fix
                  app/assets/javascripts/iframe-phone.js on lines 7..481

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

                  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

                    function post(type, content) {
                      var message;
                      // Message object can be constructed from 'type' and 'content' arguments or it can be passed
                      // as the first argument.
                      if (arguments.length === 1 && typeof type === 'object' && typeof type.type === 'string') {
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 7 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 289..316

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

                  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

                  },{"./structured-clone":4}],4:[function(require,module,exports){
                  var featureSupported = {
                    'structuredClones': 0
                  };
                  
                  
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 7 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 435..463

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

                  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

                    function messageListener(message) {
                      // Anyone can send us a message. Only pay attention to messages from parent.
                      if (message.source !== window.parent) return;
                      var messageData = message.data;
                      if (typeof messageData === 'string') messageData = JSON.parse(messageData);
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 6 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 71..88

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

                  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

                    function receiveMessage(message) {
                      var messageData;
                      if (message.source === getTargetWindow() && (targetOrigin === '*' || message.origin === targetOrigin)) {
                        messageData = message.data;
                        if (typeof messageData === 'string') {
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 5 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 347..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 148.

                  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

                    addListener('hello', function () {
                      connected = true;
                  
                      // send hello response
                      post({
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 4 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 398..419

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

                  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

                    function post(type, content) {
                      var message;
                      // Message object can be constructed from 'type' and 'content' arguments or it can be passed
                      // as the first argument.
                      if (arguments.length === 1 && typeof type === 'object' && typeof type.type === 'string') {
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 4 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 30..47

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

                  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

                  },{}],5:[function(require,module,exports){
                  module.exports = {
                    /**
                     * Allows to communicate with an iframe.
                     */
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 2 hrs to fix
                  app/assets/javascripts/iframe-phone.js on lines 463..481

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

                  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

                    function postToParent(message) {
                      // See http://dev.opera.com/articles/view/window-postmessage-messagechannel/#crossdoc
                      //     https://github.com/Modernizr/Modernizr/issues/388
                      //     http://jsfiddle.net/ryanseddon/uZTgD/2/
                      if (structuredClone.supported()) {
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/iframe-phone.js on lines 19..28

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

                  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

                    function initialize() {
                      if (isInitialized) {
                        return;
                      }
                      isInitialized = true;
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/iframe-phone.js on lines 103..114

                  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

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

                    function startPostingHello() {
                      if (helloInterval) {
                        stopPostingHello();
                      }
                      helloInterval = window.setInterval(postHello, HELLO_INTERVAL_LENGTH);
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/iframe-phone.js on lines 116..124

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

                  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

                    if (targetWindowIsIframeElement) {
                      // Infer the origin ONLY if the user did not supply an explicit origin, i.e., if the second
                      // argument is empty or is actually a callback (meaning it is supposed to be the
                      // afterConnectionCallback)
                      if (!targetOrigin || targetOrigin.constructor === Function) {
                  Severity: Major
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/iframe-phone.js on lines 377..385

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

                  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

                    function getTargetWindow() {
                      if (targetWindowIsIframeElement) {
                        var tWindow = targetWindowOrIframeEl.contentWindow;
                        if (!tWindow) {
                          throw "IFrame element needs to be added to DOM before communication " +
                  Severity: Minor
                  Found in public/demo-interactives/iframe-phone.js and 1 other location - About 55 mins to fix
                  app/assets/javascripts/iframe-phone.js on lines 335..345

                  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

                  There are no issues that match your filters.

                  Category
                  Status