mambax7/smartfaq

View on GitHub
assets/js/overlib/mini/overlib_shadow_mini.js

Summary

Maintainability
F
1 wk
Test Coverage

Function generateShadow has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
Open

function generateShadow(content) {
    var wd, ht, X = 0, Y = 0, zIdx = 0, txt, dpObj, puObj, bS = '', aPos, posStr = new Array();
    if (!o3_shadow || (o3_shadowx == 0 && o3_shadowy == 0)) return;
    X = Math.abs(o3_shadowx);
    Y = Math.abs(o3_shadowy);
Severity: Minor
Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 1 day 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 generateShadow has 89 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function generateShadow(content) {
    var wd, ht, X = 0, Y = 0, zIdx = 0, txt, dpObj, puObj, bS = '', aPos, posStr = new Array();
    if (!o3_shadow || (o3_shadowx == 0 && o3_shadowy == 0)) return;
    X = Math.abs(o3_shadowx);
    Y = Math.abs(o3_shadowy);
Severity: Major
Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 3 hrs to fix

    Function parseShadowExtras has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    function parseShadowExtras(pf, i, ar) {
        var k = i, v;
        if (k < ar.length) {
            if (ar[k] == SHADOW) {
                eval(pf + 'shadow=(' + pf + 'shadow==0)?1:0');
    Severity: Minor
    Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 2 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 parseShadowExtras has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function parseShadowExtras(pf, i, ar) {
        var k = i, v;
        if (k < ar.length) {
            if (ar[k] == SHADOW) {
                eval(pf + 'shadow=(' + pf + 'shadow==0)?1:0');
    Severity: Minor
    Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

              if (o3_shadowy > 0) {
                  posStr[0] = ' left:0; top:' + Y + 'px';
                  posStr[1] = ' left:' + X + 'px; top:0';
              } else if (o3_shadowy < 0) {
                  posStr[0] = ' left:0; top:0';
      Severity: Major
      Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 45 mins to fix

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

        function cleanUpShadowEffects() {
            if (olNs4) return; else {
                var dpObj = (olIe4 ? o3_frame.document.all['backdrop'] : o3_frame.document.getElementById('backdrop'));
                if (olIe4 && !isMac && dpObj.filters.Beta) dpObj.filters.Beta.enabled = false; else if (typeof(dpObj.style.MozOpacity) == 'string') dpObj.style.MozOpacity = 1.0;
            }
        Severity: Minor
        Found in assets/js/overlib/mini/overlib_shadow_mini.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

        Avoid too many return statements within this function.
        Open

                    return k;
        Severity: Major
        Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return k;
          Severity: Major
          Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return -1;
            Severity: Major
            Found in assets/js/overlib/mini/overlib_shadow_mini.js - About 30 mins to fix

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

                  if (o3_shadowx == 0) {
                      if (o3_shadowy < 0) {
                          posStr[0] = ' left:0; top: 0';
                          posStr[1] = ' left:0; top: ' + Y + 'px';
                      } else if (o3_shadowy > 0) {
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 2 days to fix
              assets/js/overlib/overlib_shadow.js on lines 129..161

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

              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 parseShadowExtras(pf, i, ar) {
                  var k = i, v;
                  if (k < ar.length) {
                      if (ar[k] == SHADOW) {
                          eval(pf + 'shadow=(' + pf + 'shadow==0)?1:0');
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 1 day to fix
              assets/js/overlib/overlib_shadow.js on lines 65..97

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

              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 (olNs4 && bkSet) {
                      dpObj = over.document.layers['backdrop'];
                      if (typeof dpObj == 'undefined') return;
                      puObj = over.document.layers['PUContent'];
                      wd = puObj.clip.width;
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 1 day to fix
              assets/js/overlib/overlib_shadow.js on lines 181..221

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

              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 cleanUpShadowEffects() {
                  if (olNs4) return; else {
                      var dpObj = (olIe4 ? o3_frame.document.all['backdrop'] : o3_frame.document.getElementById('backdrop'));
                      if (olIe4 && !isMac && dpObj.filters.Beta) dpObj.filters.Beta.enabled = false; else if (typeof(dpObj.style.MozOpacity) == 'string') dpObj.style.MozOpacity = 1.0;
                  }
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 4 hrs to fix
              assets/js/overlib/overlib_shadow.js on lines 234..241

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

              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 shadow_cursorOff() {
                  var left = parseInt(over.style.left);
                  var top = parseInt(over.style.top);
                  var right = left + (o3_shadow ? o3_width : over.offsetWidth);
                  var bottom = top + (o3_shadow ? o3_aboveheight : over.offsetHeight);
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 4 hrs to fix
              assets/js/overlib/overlib_shadow.js on lines 101..109

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

              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 shadowAdjust() {
                  if (!olNs4) return;
                  var fac = ol_shadowadjust;
                  if (olNs4) {
                      document.write('<style type="text/css">\n<!--\n');
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 2 hrs to fix
              assets/js/overlib/overlib_shadow.js on lines 244..252

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

              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 (olNs4) {
                      txt += '<div id="PUContent">' + content + '</div>';
                  } else {
                      txt += bS + '"></div><div id="PUContent" style="position: absolute;' + posStr[1] + '; width: ' + wd + 'px; z-index: ' + (zIdx++) + ';">' + content + '</div>';
                  }
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 2 hrs to fix
              assets/js/overlib/overlib_shadow.js on lines 173..177

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

              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

                  txt = (olNs4) ? '<div id="backdrop"></div>' : ((olIe55 && olHideForm) ? bckDropSrc(wd + X, ht + Y, zIdx++) : '') + '<div id="backdrop" style="position: absolute;' + posStr[0] + '; width: ' + wd + 'px; z-index: ' + (zIdx++) + '; ';
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 1 hr to fix
              assets/js/overlib/overlib_shadow.js on lines 163..163

              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

                  if (o3_shadowimage) {
                      bS = 'background-image: url(' + o3_shadowimage + ');';
                      if (olNs4) bkSet = 1;
                  } else {
                      bS = 'background-color: ' + o3_shadowcolor + ';';
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 1 hr to fix
              assets/js/overlib/overlib_shadow.js on lines 165..171

              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

              function checkShadowPreHide() {
                  if (o3_shadow && o3_shadowopacity) cleanUpShadowEffects();
                  if (o3_shadow && (olIe4 && isMac)) over.style.pixelWidth = over.style.pixelHeight = 0;
              }
              Severity: Major
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 1 hr to fix
              assets/js/overlib/overlib_shadow.js on lines 112..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 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

                  var wd, ht, X = 0, Y = 0, zIdx = 0, txt, dpObj, puObj, bS = '', aPos, posStr = new Array();
              Severity: Minor
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 40 mins to fix
              assets/js/overlib/overlib_shadow.js on lines 120..120

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

              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 setShadowVariables() {
                  o3_shadow = ol_shadow;
                  o3_shadowcolor = ol_shadowcolor;
                  o3_shadowimage = ol_shadowimage;
                  o3_shadowopacity = ol_shadowopacity;
              Severity: Minor
              Found in assets/js/overlib/mini/overlib_shadow_mini.js and 1 other location - About 35 mins to fix
              assets/js/overlib/overlib_shadow.js on lines 54..61

              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