CaffGeek/MBACNationals

View on GitHub
Web.Admin/2014/js/dw_rotator_aux.js

Summary

Maintainability
F
1 wk
Test Coverage

Function dw_getRandomImage has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

function dw_getRandomImage(rObj, bReturn) {
    var imgAr = rObj.images;  if (!imgAr ) return '';
    var num = Math.floor( Math.random() * imgAr.length );
    var imgStr = '';   var imgFile = imgAr[ num ];
    rObj.num = num; // hold which img selected (for ctr)
Severity: Minor
Found in Web.Admin/2014/js/dw_rotator_aux.js - About 4 hrs 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 dw_getElementsByClassName has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

function dw_getElementsByClassName(sClass, sTag, oCont) {
    var result = [], list, i;
    var re = new RegExp("\\b" + sClass + "\\b", "i");
    oCont = oCont? oCont: document;
    if ( document.getElementsByTagName ) {
Severity: Minor
Found in Web.Admin/2014/js/dw_rotator_aux.js - About 1 hr 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 dw_getRandomImage has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function dw_getRandomImage(rObj, bReturn) {
    var imgAr = rObj.images;  if (!imgAr ) return '';
    var num = Math.floor( Math.random() * imgAr.length );
    var imgStr = '';   var imgFile = imgAr[ num ];
    rObj.num = num; // hold which img selected (for ctr)
Severity: Minor
Found in Web.Admin/2014/js/dw_rotator_aux.js - About 1 hr to fix

    Function openSubWin has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    function openSubWin(url, nm, x, y, w, h, atts) {
    Severity: Major
    Found in Web.Admin/2014/js/dw_rotator_aux.js - About 50 mins to fix

      Function addControls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      dw_Rotator.addControls = function() {
          var els = dw_getElementsByClassName('rotator_controls');
          for (var i=0; els[i]; i++) {
              var links = els[i].getElementsByTagName('a');
              for (var j=0; links[j]; j++) {
      Severity: Minor
      Found in Web.Admin/2014/js/dw_rotator_aux.js - About 35 mins 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

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

      function dw_getRandomImage(rObj, bReturn) {
          var imgAr = rObj.images;  if (!imgAr ) return '';
          var num = Math.floor( Math.random() * imgAr.length );
          var imgStr = '';   var imgFile = imgAr[ num ];
          rObj.num = num; // hold which img selected (for ctr)
      Severity: Major
      Found in Web.Admin/2014/js/dw_rotator_aux.js and 1 other location - About 3 days to fix
      Web.Admin/2015/js/dw_rotator_aux.js on lines 16..54

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

      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 openSubWin(url, nm, x, y, w, h, atts) {
          nm = nm || "subwindow";
          atts = atts || "menubar,resizable,scrollbars";
          w = w || 600; h = h || 450;
          x = (typeof x=="number")? x: Math.round( (screen.availWidth - w)/2 );
      Severity: Major
      Found in Web.Admin/2014/js/dw_rotator_aux.js and 1 other location - About 1 day to fix
      Web.Admin/2015/js/dw_rotator_aux.js on lines 121..133

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

      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

      dw_Rotator.addControls = function() {
          var els = dw_getElementsByClassName('rotator_controls');
          for (var i=0; els[i]; i++) {
              var links = els[i].getElementsByTagName('a');
              for (var j=0; links[j]; j++) {
      Severity: Major
      Found in Web.Admin/2014/js/dw_rotator_aux.js and 1 other location - About 1 day to fix
      Web.Admin/2015/js/dw_rotator_aux.js on lines 59..72

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

      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 dw_getElementsByClassName(sClass, sTag, oCont) {
          var result = [], list, i;
          var re = new RegExp("\\b" + sClass + "\\b", "i");
          oCont = oCont? oCont: document;
          if ( document.getElementsByTagName ) {
      Severity: Major
      Found in Web.Admin/2014/js/dw_rotator_aux.js and 1 other location - About 7 hrs to fix
      Web.Admin/2015/js/dw_rotator_aux.js on lines 87..101

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

      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 displayImgInSubWin(id) {
          var rObj = dw_Rotator.getInstanceById(id);
          // notice access to properties of the instance available here 
          // file name could be based on the image file name, perhaps to display a larger version
          var file = rObj.imgs[rObj.ctr].src;
      Severity: Major
      Found in Web.Admin/2014/js/dw_rotator_aux.js and 1 other location - About 1 hr to fix
      Web.Admin/2015/js/dw_rotator_aux.js on lines 108..115

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

      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 dw_hasClass(el, cl) {
          var re = new RegExp("\\b" + cl + "\\b", "i");
          if ( re.test( el.className ) ) {
              return true;
          }
      Severity: Major
      Found in Web.Admin/2014/js/dw_rotator_aux.js and 1 other location - About 1 hr to fix
      Web.Admin/2015/js/dw_rotator_aux.js on lines 79..85

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

      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