GuilhermeStracini/TCC-SENAC

View on GitHub
Src/scripts/swfobject_modified.js

Summary

Maintainability
F
2 wks
Test Coverage

Function swfobject has a Cognitive Complexity of 401 (exceeds 5 allowed). Consider refactoring.
Open

var swfobject = function() {
    
    var UNDEF = "undefined",
        OBJECT = "object",
        SHOCKWAVE_FLASH = "Shockwave Flash",
Severity: Minor
Found in Src/scripts/swfobject_modified.js - About 1 wk to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function swfobject has 576 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var swfobject = function() {
    
    var UNDEF = "undefined",
        OBJECT = "object",
        SHOCKWAVE_FLASH = "Shockwave Flash",
Severity: Major
Found in Src/scripts/swfobject_modified.js - About 2 days to fix

    File swfobject_modified.js has 578 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!    SWFObject v2.0 <http://code.google.com/p/swfobject/>
        Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
        This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
    */
    
    
    Severity: Major
    Found in Src/scripts/swfobject_modified.js - About 1 day to fix

      Function createSWF has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function createSWF(attObj, parObj, id) {
              var r, el = getElementById(id);
              if (typeof attObj.id == UNDEF) { // if no 'id' is defined for the object element, it will inherit the 'id' from the alternative content
                  attObj.id = id;
              }
      Severity: Major
      Found in Src/scripts/swfobject_modified.js - About 3 hrs to fix

        Function ua has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var ua = function() {
                var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF && typeof doc.appendChild != UNDEF && typeof doc.replaceChild != UNDEF && typeof doc.removeChild != UNDEF && typeof doc.cloneNode != UNDEF,
                    playerVersion = [0,0,0],
                    d = null;
                if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
        Severity: Major
        Found in Src/scripts/swfobject_modified.js - About 2 hrs to fix

          Function embedSWF has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
                      if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
                          return;
                      }
                      widthStr += ""; // Auto-convert to string to make it idiot proof
          Severity: Minor
          Found in Src/scripts/swfobject_modified.js - About 1 hr to fix

            Function showExpressInstall has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function showExpressInstall(regObj) {
                    isExpressInstallActive = true;
                    var obj = getElementById(regObj.id);
                    if (obj) {
                        if (regObj.altContentId) {
            Severity: Minor
            Found in Src/scripts/swfobject_modified.js - About 1 hr to fix

              Function embedSWF has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
              Severity: Major
              Found in Src/scripts/swfobject_modified.js - About 1 hr to fix

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

                    var onDomLoad = function() {
                        if (!ua.w3cdom) {
                            return;
                        }
                        addDomLoadEvent(main);
                Severity: Minor
                Found in Src/scripts/swfobject_modified.js - About 1 hr to fix

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

                      function main() { // Static publishing only
                          var rl = regObjArr.length;
                          for (var i = 0; i < rl; i++) { // For each registered object element
                              var id = regObjArr[i].id;
                              if (ua.pv[0] > 0) {
                  Severity: Minor
                  Found in Src/scripts/swfobject_modified.js - About 1 hr to fix

                    Avoid deeply nested control flow statements.
                    Open

                                        else if (regObjArr[i].expressInstall && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe Express Install dialog if set by the web page author and if supported (fp6.0.65+ on Win/Mac OS only)
                                            showExpressInstall(regObjArr[i]);
                                        }
                                        else { // Flash plug-in and Flash content version mismatch: display alternative content instead of Flash content
                                            displayAltContent(obj);
                    Severity: Major
                    Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (typeof par.flashvars != UNDEF) {
                                                      par.flashvars += "&" + i + "=" + flashvarsObj[i];
                                                  }
                                                  else {
                                                      par.flashvars = i + "=" + flashvarsObj[i];
                      Severity: Major
                      Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if (!(c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "param") && !(c[i].nodeType == 8)) {
                                                    ac.appendChild(c[i].cloneNode(true));
                                                }
                        Severity: Major
                        Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if (m.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                                                  o.setAttribute("class", attObj[m]);
                                              }
                                              else if (m != "classid") { // Filter out IE specific attribute
                                                  o.setAttribute(m, attObj[m]);
                          Severity: Major
                          Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (ua.webkit && ua.webkit < 312) { // Older webkit engines ignore the object element's nested param elements
                                                        fixParams(obj);
                                                    }
                            Severity: Major
                            Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if (l != "movie") { // Filter out IE specific param element
                                                      e.setAttribute(l, parObj[l]);
                                                  }
                              Severity: Major
                              Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if (k == "data") {
                                                        e.setAttribute("src", attObj[k]);
                                                    }
                                                    else if (k.toLowerCase() == "styleclass") { // 'class' is an ECMA4 reserved keyword
                                                        e.setAttribute("class", attObj[k]);
                                Severity: Major
                                Found in Src/scripts/swfobject_modified.js - About 45 mins to fix

                                  Consider simplifying this complex logical expression.
                                  Open

                                              if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
                                                  return;
                                              }
                                  Severity: Major
                                  Found in Src/scripts/swfobject_modified.js - About 40 mins to fix

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

                                            for (var i = 0; i < cl; i++) {
                                                if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "object") {
                                                    c = c[i].childNodes;
                                                    cl = c.length;
                                                    i = 0;
                                    Severity: Major
                                    Found in Src/scripts/swfobject_modified.js and 1 other location - About 7 hrs to fix
                                    Src/scripts/swfobject_modified.js on lines 514..523

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

                                    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 < cl; i++) {
                                                if (c[i].nodeType == 1 && c[i].nodeName.toLowerCase() == "object") {
                                                    c = c[i].childNodes;
                                                    cl = c.length;
                                                    i = 0;
                                    Severity: Major
                                    Found in Src/scripts/swfobject_modified.js and 1 other location - About 7 hrs to fix
                                    Src/scripts/swfobject_modified.js on lines 496..505

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

                                    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 (!(/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
                                                    regObj.height = "137";
                                                }
                                    Severity: Minor
                                    Found in Src/scripts/swfobject_modified.js and 1 other location - About 40 mins to fix
                                    Src/scripts/swfobject_modified.js on lines 290..292

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

                                    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 (!(/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
                                                    regObj.width = "310";
                                                }
                                    Severity: Minor
                                    Found in Src/scripts/swfobject_modified.js and 1 other location - About 40 mins to fix
                                    Src/scripts/swfobject_modified.js on lines 293..295

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

                                    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