betajs/betajs-media-components

View on GitHub
src/dynamics/ads_player/ads_player.js

Summary

Maintainability
D
2 days
Test Coverage

File ads_player.js has 706 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:Ads.Dynamics.Player", [
    "base:Objs",
    "browser:Info",
    "base:Maths",
    "base:Types",
Severity: Major
Found in src/dynamics/ads_player/ads_player.js - About 1 day to fix

    Function _renderCompanionAd has 109 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    _renderCompanionAd: function(ad, options) {
                        // Do not render anything if options is boolean and false
                        if (Types.is_boolean(options) && !Boolean(options)) return;
    
                        ad = ad || this.get("ad");
    Severity: Major
    Found in src/dynamics/ads_player/ads_player.js - About 4 hrs to fix

      Function create has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                      create: function() {
                          var dynamics = this.parent();
                          var adContainer = this.getAdContainer();
                          var adManagerOptions = {
                              adContainer: adContainer,
      Severity: Major
      Found in src/dynamics/ads_player/ads_player.js - About 2 hrs to fix

        Function _onStart has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                        _onStart: function(ev) {
                            this.set("playing", true);
                            this.set("currenttime", 0);
                            this.set("remaining", this.get("duration"));
                            this.set("showactionbuttons", false);
        Severity: Minor
        Found in src/dynamics/ads_player/ads_player.js - About 1 hr to fix

          TODO found
          Open

                              // TODO: add option for selection
          Severity: Minor
          Found in src/dynamics/ads_player/ads_player.js by fixme

          TODO found
          Open

                                  this._videoElement = this.parent() && this.parent().activeElement().querySelector("[data-video='video']"); // TODO video element for outstream
          Severity: Minor
          Found in src/dynamics/ads_player/ads_player.js by fixme

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

                              return this.activeElement().firstChild ? this.activeElement().firstChild.clientHeight : this.activeElement().clientHeight;
          Severity: Minor
          Found in src/dynamics/ads_player/ads_player.js and 1 other location - About 35 mins to fix
          src/dynamics/ads_player/ads_player.js on lines 362..362

          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

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

                              return this.activeElement().firstChild ? this.activeElement().firstChild.clientWidth : this.activeElement().clientWidth;
          Severity: Minor
          Found in src/dynamics/ads_player/ads_player.js and 1 other location - About 35 mins to fix
          src/dynamics/ads_player/ads_player.js on lines 369..369

          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

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

                                      height = Number((companionAdDimensions && companionAdDimensions[1] && companionAdDimensions[1] > 0) ?
                                          companionAdDimensions[1] : containerDimensions.height);
          Severity: Minor
          Found in src/dynamics/ads_player/ads_player.js and 1 other location - About 30 mins to fix
          src/dynamics/ads_player/ads_player.js on lines 681..682

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

          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

                                      width = Number((companionAdDimensions && companionAdDimensions[0] && companionAdDimensions[0] > 0) ?
                                          companionAdDimensions[0] : containerDimensions.width);
          Severity: Minor
          Found in src/dynamics/ads_player/ads_player.js and 1 other location - About 30 mins to fix
          src/dynamics/ads_player/ads_player.js on lines 683..684

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

          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