harella1/video.js

View on GitHub

Showing 221 of 221 total issues

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

  getTrackById(id) {
    let result = null;

    for (let i = 0, l = this.length; i < l; i++) {
      let track = this[i];
Severity: Major
Found in src/js/tracks/track-list.js and 2 other locations - About 2 hrs to fix
src/js/tracks/text-track-cue-list.js on lines 89..102
src/js/tracks/text-track-list.js on lines 101..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 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 3 locations. Consider refactoring.
Open

  getCueById(id) {
    let result = null;

    for (let i = 0, l = this.length; i < l; i++) {
      let cue = this[i];
Severity: Major
Found in src/js/tracks/text-track-cue-list.js and 2 other locations - About 2 hrs to fix
src/js/tracks/text-track-list.js on lines 101..114
src/js/tracks/track-list.js on lines 117..129

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

  getTrackById(id) {
    let result = null;

    for (let i = 0, l = this.length; i < l; i++) {
      let track = this[i];
Severity: Major
Found in src/js/tracks/text-track-list.js and 2 other locations - About 2 hrs to fix
src/js/tracks/text-track-cue-list.js on lines 89..102
src/js/tracks/track-list.js on lines 117..129

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

Function constructor has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(tracks = []) {
    let list;

    // make sure only 1 track is enabled
    // sorted from last index to first index
Severity: Minor
Found in src/js/tracks/video-track-list.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

File flash.js has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @file flash.js
 * VideoJS-SWF - Custom Flash Player with HTML5-ish API
 * https://github.com/zencoder/video-js-swf
 * Not using setupTriggers. Using global onEvent func to distribute events
Severity: Minor
Found in src/js/tech/flash.js - About 2 hrs to fix

    Function fixEvent has 64 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function fixEvent(event) {
    
      function returnTrue() { return true; }
      function returnFalse() { return false; }
    
    
    Severity: Major
    Found in src/js/utils/events.js - About 2 hrs to fix

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

          if (options.playerOptions &&
              options.playerOptions.controlBar &&
              options.playerOptions.controlBar.progressControl &&
              options.playerOptions.controlBar.progressControl.keepTooltipsInside) {
            this.keepTooltipsInside = options.playerOptions.controlBar.progressControl.keepTooltipsInside;
      Severity: Major
      Found in src/js/control-bar/progress-control/play-progress-bar.js and 2 other locations - About 2 hrs to fix
      src/js/control-bar/progress-control/mouse-time-display.js on lines 25..30
      src/js/control-bar/progress-control/seek-bar.js on lines 30..35

      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

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

          if (options.playerOptions &&
              options.playerOptions.controlBar &&
              options.playerOptions.controlBar.progressControl &&
              options.playerOptions.controlBar.progressControl.keepTooltipsInside) {
            this.keepTooltipsInside = options.playerOptions.controlBar.progressControl.keepTooltipsInside;
      Severity: Major
      Found in src/js/control-bar/progress-control/seek-bar.js and 2 other locations - About 2 hrs to fix
      src/js/control-bar/progress-control/mouse-time-display.js on lines 25..30
      src/js/control-bar/progress-control/play-progress-bar.js on lines 25..30

      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

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

          if (options.playerOptions &&
              options.playerOptions.controlBar &&
              options.playerOptions.controlBar.progressControl &&
              options.playerOptions.controlBar.progressControl.keepTooltipsInside) {
            this.keepTooltipsInside = options.playerOptions.controlBar.progressControl.keepTooltipsInside;
      Severity: Major
      Found in src/js/control-bar/progress-control/mouse-time-display.js and 2 other locations - About 2 hrs to fix
      src/js/control-bar/progress-control/play-progress-bar.js on lines 25..30
      src/js/control-bar/progress-control/seek-bar.js on lines 30..35

      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

      Function constructor has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        constructor(options, ready){
          super(options, ready);
      
          const source = options.source;
          let crossoriginTracks = false;
      Severity: Major
      Found in src/js/tech/html5.js - About 2 hrs to fix

        Function controls has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

          controls(bool) {
            if (bool !== undefined) {
              bool = !!bool; // force boolean
              // Don't trigger a change event unless it actually changed
              if (this.controls_ !== bool) {
        Severity: Minor
        Found in src/js/player.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

        File text-track-settings.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @file text-track-settings.js
         */
        import Component from '../component';
        import * as Events from '../utils/events.js';
        Severity: Minor
        Found in src/js/tracks/text-track-settings.js - About 2 hrs to fix

          Function FlashRtmpDecorator has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function FlashRtmpDecorator(Flash) {
            Flash.streamingFormats = {
              'rtmp/mp4': 'MP4',
              'rtmp/flv': 'FLV'
            };
          Severity: Major
          Found in src/js/tech/flash-rtmp.js - About 2 hrs to fix

            File dom.js has 262 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /**
             * @file dom.js
             */
            import document from 'global/document';
            import window from 'global/window';
            Severity: Minor
            Found in src/js/utils/dom.js - About 2 hrs to fix

              Function initChildren has 57 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                initChildren() {
                  let children = this.options_.children;
              
                  if (children) {
                    // `this` is `parent`
              Severity: Major
              Found in src/js/component.js - About 2 hrs to fix

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

                  pressButton() {
                    if (this.enabled_) {
                      this.buttonPressed_ = true;
                      this.menu.lockShowing();
                      this.el_.setAttribute('aria-expanded', 'true');
                Severity: Major
                Found in src/js/menu/menu-button.js and 1 other location - About 2 hrs to fix
                src/js/menu/menu-button.js on lines 222..229

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

                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

                    Object.defineProperty(track, 'enabled', {
                      get() { return enabled; },
                      set(newEnabled) {
                        // an invalid or unchanged value
                        if (typeof newEnabled !== 'boolean' || newEnabled === enabled) {
                Severity: Major
                Found in src/js/tracks/audio-track.js and 1 other location - About 2 hrs to fix
                src/js/tracks/video-track.js on lines 40..50

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

                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

                  unpressButton() {
                    if (this.enabled_) {
                      this.buttonPressed_ = false;
                      this.menu.unlockShowing();
                      this.el_.setAttribute('aria-expanded', 'false');
                Severity: Major
                Found in src/js/menu/menu-button.js and 1 other location - About 2 hrs to fix
                src/js/menu/menu-button.js on lines 208..215

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

                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

                    Object.defineProperty(track, 'selected', {
                      get() { return selected; },
                      set(newSelected) {
                        // an invalid or unchanged value
                        if (typeof newSelected !== 'boolean' || newSelected === selected) {
                Severity: Major
                Found in src/js/tracks/video-track.js and 1 other location - About 2 hrs to fix
                src/js/tracks/audio-track.js on lines 39..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 80.

                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

                Function updateStyleEl_ has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  updateStyleEl_() {
                    if (window.VIDEOJS_NO_DYNAMIC_STYLE === true) {
                      const width = typeof this.width_ === 'number' ? this.width_ : this.options_.width;
                      const height = typeof this.height_ === 'number' ? this.height_ : this.options_.height;
                      let techEl = this.tech_ && this.tech_.el();
                Severity: Major
                Found in src/js/player.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language