betajs/betajs-media-components

View on GitHub
src/dynamics/video_player/controlbar/controlbar.js

Summary

Maintainability
F
6 days
Test Coverage

File controlbar.js has 435 lines of code (exceeds 250 allowed). Consider refactoring.
Open

Scoped.define("module:VideoPlayer.Dynamics.Controlbar", [
    "dynamics:Dynamic",
    "base:TimeFormat",
    "base:Comparators",
    "base:Maths",
Severity: Minor
Found in src/dynamics/video_player/controlbar/controlbar.js - About 6 hrs to fix

    Function progressUpdatePosition has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                        progressUpdatePosition: function(event) {
                            var _dyn = this.__parent;
    
                            // Mouse or Touch Event
                            var clientX = event.clientX === 0 ? 0 : event.clientX || event.targetTouches[0].clientX;
    Severity: Minor
    Found in src/dynamics/video_player/controlbar/controlbar.js - About 1 hr to fix

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

                          select_frame: function() {
                              var player = this.parent().player;
                              var position = player.position();
                              var imageSelected = false;
      
      
      Severity: Minor
      Found in src/dynamics/video_player/controlbar/controlbar.js - About 1 hr to fix

        Function addTrimmingEventListeners has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                            addTrimmingEventListeners: function() {
                                var events = this.get("events");
                                var trimStartMarker = this.activeElement().querySelector('[data-selector="trim-start-marker"]');
                                var trimEndMarker = this.activeElement().querySelector('[data-selector="trim-end-marker"]');
        
        
        Severity: Minor
        Found in src/dynamics/video_player/controlbar/controlbar.js - About 1 hr to fix

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

                              startUpdateVolume: function(args, element) {
                                  var event = args[0];
                                  var moveEvent = event.type === "mousedown" ? "mousemove" : "touchmove";
                                  var stopEvent = event.type === "mousedown" ? "mouseup" : "touchend";
                                  var domRect = element.getBoundingClientRect();
          Severity: Minor
          Found in src/dynamics/video_player/controlbar/controlbar.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                                                    if (_dyn.get("thumbcuelist")[i]) {
                                                        var _cue = _dyn.get("thumbcuelist")[i];
                                                        if (_cue.startTime < onDuration && _cue.endTime > onDuration) {
                                                            _trackTags.showDurationThumb(i, clientX, onDuration);
                                                            break;
            Severity: Major
            Found in src/dynamics/video_player/controlbar/controlbar.js - About 45 mins to fix

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

                                      var updateVolume = function(event) {
                                          var volume;
                                          event.preventDefault();
                                          if (domRect.width > domRect.height) {
                                              // Horizontal slider
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 1 day to fix
              src/dynamics/ads_player/ads_controlbar/ads_controlbar.js on lines 61..76

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

              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

                                      events.on(trimEndMarker, "mousedown touchstart", function(e) {
                                          e.preventDefault();
                                          e.stopPropagation();
              
                                          var boundingRect = this.get("progressbarElement").getBoundingClientRect();
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 6 hrs to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 391..407

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

              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

                                      events.on(trimStartMarker, "mousedown touchstart", function(e) {
                                          e.preventDefault();
                                          e.stopPropagation();
              
                                          var boundingRect = this.get("progressbarElement").getBoundingClientRect();
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 6 hrs to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 409..425

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

              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 Class.extend({
                          scoped: scoped
                      }, function(inherited) {
                          return {
              
              
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 4 hrs to fix
              src/dynamics/video_recorder/controlbar/controlbar.js on lines 10..140

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

              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 (clientX < dimensions.left) percentageFromStart = 0;
                                      else if (clientX > (dimensions.left + dimensions.width)) percentageFromStart = 1;
                                      else {
                                          percentageFromStart = (clientX - dimensions.left) / (dimensions.width || 1);
                                      }
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 2 hrs to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 457..461

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

              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 (clientX < dimensions.left) percentageFromStart = 0;
                                      else if (clientX > (dimensions.left + dimensions.width)) percentageFromStart = 1;
                                      else {
                                          percentageFromStart = (clientX - dimensions.left) / (dimensions.width || 1);
                                      }
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 2 hrs to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 131..135

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

              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 (value > this.get("hidebarafter") && this.get("hideoninactivity")) {
                                          this.set("controlbar_hide_class", this.get("cssplayer") + "-dashboard-hidden");
                                      } else {
                                          this.set("controlbar_hide_class", "");
                                      }
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 1 hr to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 73..77

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

              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 (value > this.get("hidebarafter") && this.get("hideoninactivity")) {
                                              this.set("title_hide_class", this.get("cssplayer") + "-dashboard-hidden");
                                          } else {
                                              this.set("title_hide_class", "");
                                          }
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 1 hr to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 79..83

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

              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 (!this.__parent.get("playing") && this.__parent.player && !this.get("manuallypaused"))
                                          this.__parent.player.play();
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 1 hr to fix
              src/dynamics/audio_player/controlbar/controlbar.js on lines 48..49

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

              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

                                  formatTime: function(time) {
                                      time = Math.max(time || 0, 0.1);
                                      return TimeFormat.format(TimeFormat.ELAPSED_MINUTES_SECONDS, time * 1000);
                                  },
              Severity: Minor
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 50 mins to fix
              src/dynamics/audio_player/controlbar/controlbar.js on lines 40..43

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

              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 (volume > 0) {
                                          this.__oldVolume = volume;
                                          volume = 0;
                                      } else {
                                          volume = this.__oldVolume || 1;
              Severity: Minor
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 40 mins to fix
              src/dynamics/ads_player/ads_controlbar/ads_controlbar.js on lines 111..116

              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

                                  getClientX: function(event) {
                                      return event.clientX === 0 ? 0 : event.clientX || event.targetTouches[0].clientX;
                                  },
              Severity: Minor
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 40 mins to fix
              src/dynamics/video_recorder/trimmer/trimmer.js on lines 135..137

              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

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

                                      if (position > trimEnd - timeMinLimit) {
                                          this.set("trimstart", trimEnd - timeMinLimit);
                                      } else {
                                          this.set("trimstart", position);
                                      }
              Severity: Minor
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 35 mins to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 443..447

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

              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 (position < trimStart + timeMinLimit) {
                                          this.set("trimend", trimStart + timeMinLimit);
                                      } else {
                                          this.set("trimend", position);
                                      }
              Severity: Minor
              Found in src/dynamics/video_player/controlbar/controlbar.js and 1 other location - About 35 mins to fix
              src/dynamics/video_player/controlbar/controlbar.js on lines 432..436

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

              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 7 locations. Consider refactoring.
              Open

                                  submit: function() {
                                      this.set("submittable", false);
                                      this.set("rerecordable", false);
                                      this.trigger("submit");
                                  },
              Severity: Major
              Found in src/dynamics/video_player/controlbar/controlbar.js and 6 other locations - About 30 mins to fix
              src/dynamics/audio_player/controlbar/controlbar.js on lines 174..178
              src/dynamics/audio_recorder/recorder/recorder.js on lines 587..591
              src/dynamics/image_capture/capture/capture.js on lines 463..467
              src/dynamics/image_viewer/controlbar/controlbar.js on lines 37..41
              src/dynamics/video_player/playbutton/playbutton.js on lines 35..39
              src/dynamics/video_recorder/recorder/recorder.js on lines 1114..1118

              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