mambax7/marquee

View on GitHub
assets/js/xbMarquee.js

Summary

Maintainability
F
1 wk
Test Coverage

Function start has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
Open

XbMarquee.prototype.start = function () {
    var markup = '';

    this.stop();

Severity: Minor
Found in assets/js/xbMarquee.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 start has 129 lines of code (exceeds 25 allowed). Consider refactoring.
Open

XbMarquee.prototype.start = function () {
    var markup = '';

    this.stop();

Severity: Major
Found in assets/js/xbMarquee.js - About 5 hrs to fix

    File xbMarquee.js has 291 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ***** BEGIN LICENSE BLOCK *****
     * The contents of this file are subject to the Mozilla Public License Version
     * 1.1 (the "License"); you may not use this file except in compliance with
     * the License. You may obtain a copy of the License at
     * http://www.mozilla.org/MPL/
    Severity: Minor
    Found in assets/js/xbMarquee.js - About 3 hrs to fix

      Function XbMarquee has 69 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) {
          this.id = id;
          this.scrollAmount = scrollAmount ? scrollAmount : 6;
          this.scrollDelay = scrollDelay ? scrollDelay : 85;
          this.direction = direction ? direction.toLowerCase() : 'left';
      Severity: Major
      Found in assets/js/xbMarquee.js - About 2 hrs to fix

        Function XbMarquee has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) {
            this.id = id;
            this.scrollAmount = scrollAmount ? scrollAmount : 6;
            this.scrollDelay = scrollDelay ? scrollDelay : 85;
            this.direction = direction ? direction.toLowerCase() : 'left';
        Severity: Minor
        Found in assets/js/xbMarquee.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 _getInnerSize has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        XbMarquee._getInnerSize = function (elm, propName) {
            var val = 0;
        
            if (document.layers) {
                // navigator 4
        Severity: Minor
        Found in assets/js/xbMarquee.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 XbMarquee has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function XbMarquee(id, height, width, scrollAmount, scrollDelay, direction, behavior, html) {
        Severity: Major
        Found in assets/js/xbMarquee.js - About 1 hr to fix

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

                  markup = '<div id="' + this.id + 'container" name="' +
                      this.id + 'container" ' +
                      'style="position: relative; overflow: hidden; ' +
                      'height: ' + this.height + this.heightUnit + '; ' +
                      'width: ' + this.width + this.widthUnit + '; ' +
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
          assets/js/xbMarquee.js on lines 92..98

          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

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

                  markup = '<div id="' + this.id + 'container" name="' + this.id + 'container" ' +
                      'style="position: relative; overflow: scroll; ' +
                      'height: ' + this.height + this.heightUnit + '; ' +
                      'width: ' + this.width + this.widthUnit + '; ' +
                      'clip: rect(0px, ' + this.width + this.widthUnit + ', ' + this.height + this.heightUnit + ', 0px); ' +
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
          assets/js/xbMarquee.js on lines 107..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 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

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

                      case 'down':
                          this.dirsign = 1;
                          this.startAt = -XbMarquee._getInnerSize(this.div, 'height');
                          this._setTop(this.startAt);
          
          
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
          assets/js/xbMarquee.js on lines 296..306

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

          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

                      case 'right':
                          this.dirsign = 1;
                          this.startAt = -XbMarquee._getInnerSize(this.div, 'width');
                          this._setLeft(this.startAt);
          
          
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
          assets/js/xbMarquee.js on lines 271..281

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

          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

                      default:
                          this.dirsign = -1;
          
                          if (this.widthUnit == '%')
                              this.startAt = this.width * XbMarquee._getInnerSize(this.containerDiv, 'width') / 100;
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
          assets/js/xbMarquee.js on lines 283..294

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

          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

                      case 'up':
                          this.dirsign = -1;
          
                          if (this.heightUnit == '%')
                              this.startAt = this.height * XbMarquee._getInnerSize(this.containerDiv, 'height') / 100;
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 4 hrs to fix
          assets/js/xbMarquee.js on lines 309..320

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

          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 (typeof (height) == 'number') {
                  this.height = height;
                  this.heightUnit = 'px';
              } else if (typeof (height) == 'string') {
                  this.height = parseInt('0' + height, 10);
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 2 hrs to fix
          assets/js/xbMarquee.js on lines 63..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 87.

          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 (typeof (width) == 'number') {
                  this.width = width;
                  this.widthUnit = 'px';
              } else if (typeof (width) == 'string') {
                  this.width = parseInt('0' + width, 10);
          Severity: Major
          Found in assets/js/xbMarquee.js and 1 other location - About 2 hrs to fix
          assets/js/xbMarquee.js on lines 52..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 87.

          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 (this.widthUnit == '%') {
                              this.containerDiv.style.width =
                                  parentNode.offsetWidth * (this.width / 100) + 'px';
                          }
          Severity: Minor
          Found in assets/js/xbMarquee.js and 1 other location - About 55 mins to fix
          assets/js/xbMarquee.js on lines 219..222

          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

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

                          if (this.heightUnit == '%') {
                              this.containerDiv.style.height =
                                  parentNode.offsetHeight * (this.height / 100) + 'px';
                          }
          Severity: Minor
          Found in assets/js/xbMarquee.js and 1 other location - About 55 mins to fix
          assets/js/xbMarquee.js on lines 224..227

          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