harella1/video.js

View on GitHub

Showing 139 of 221 total issues

Function techGet_ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  techGet_(method) {
    if (this.tech_ && this.tech_.isReady_) {

      // Flash likes to die and reload when you hide or reposition it.
      // In these cases the object methods go away and we get errors.
Severity: Minor
Found in src/js/player.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 constructor has 34 lines of code (exceeds 25 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 1 hr to fix

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

      src(source) {
        if (source === undefined) {
          return this.techGet_('src');
        }
    
    
    Severity: Minor
    Found in src/js/player.js - About 1 hr to fix

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

      export function on(elem, type, fn){
        if (Array.isArray(type)) {
          return _handleMultipleEvents(on, elem, type, fn);
        }
      
      
      Severity: Minor
      Found in src/js/utils/events.js - About 1 hr to fix

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

          constructor(player, options) {
            super(player, options);
            this.hide();
        
            // Grab `persistTextTrackSettings` from the player options if not passed in child options
        Severity: Minor
        Found in src/js/tracks/text-track-settings.js - About 1 hr to fix

          Function createEl has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            createEl() {
              let el = this.options_.tag;
          
              // Check if this browser supports moving the element into the box.
              // On the iPhone video will break if you move the element,
          Severity: Minor
          Found in src/js/tech/html5.js - About 1 hr to fix

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

              constructor(player, options, ready) {
            
                // The component might be the player itself and we can't pass `this` to super
                if (!player && this.play) {
                  this.player_ = player = this; // eslint-disable-line
            Severity: Minor
            Found in src/js/component.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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              constructor(options = {}) {
                let settings = merge(options, {
                  kind: AudioTrackKind[options.kind] || ''
                });
                // on IE8 this will be a document element
            Severity: Minor
            Found in src/js/tracks/audio-track.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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              constructor(options = {}) {
                let settings = merge(options, {
                  kind: VideoTrackKind[options.kind] || ''
                });
            
            
            Severity: Minor
            Found in src/js/tracks/video-track.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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              constructor(tracks = []) {
                let list;
            
                // IE8 forces us to implement inheritance ourselves
                // as it does not support Object.defineProperty properly
            Severity: Minor
            Found in src/js/tracks/text-track-list.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 userActive has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              userActive(bool) {
                if (bool !== undefined) {
                  bool = !!bool;
                  if (bool !== this.userActive_) {
                    this.userActive_ = bool;
            Severity: Minor
            Found in src/js/player.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 dimension has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              dimension(widthOrHeight, num, skipListeners) {
                if (num !== undefined) {
                  // Set to zero if null or literally NaN (NaN !== NaN)
                  if (num === null || num !== num) {
                    num = 0;
            Severity: Minor
            Found in src/js/component.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 constructor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

              constructor(tracks = [], list = null) {
                super();
                if (!list) {
                  list = this;
                  if (browser.IS_IE8) {
            Severity: Minor
            Found in src/js/tracks/track-list.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 get has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  get() {
                    if (!this.loaded_) {
                      return null;
                    }
            
            
            Severity: Minor
            Found in src/js/tracks/text-track.js - About 1 hr to fix

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

              var autoSetup = function(){
                // One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*
                // var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));
                // var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));
                // var mediaEls = vids.concat(audios);
              Severity: Minor
              Found in src/js/setup.js - About 1 hr to fix

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

                  constructor(player, options){
                    let track = options['track'];
                    let tracks = player.textTracks();
                
                    // Modify options for parent MenuItem class's init.
                Severity: Minor
                Found in src/js/control-bar/text-track-controls/text-track-menu-item.js - About 1 hr to fix

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

                    constructor(player, options, ready) {
                  
                      // The component might be the player itself and we can't pass `this` to super
                      if (!player && this.play) {
                        this.player_ = player = this; // eslint-disable-line
                  Severity: Minor
                  Found in src/js/component.js - About 1 hr to fix

                    Function off has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function off(elem, type, fn) {
                      // Don't want to add a cache object through getElData if not needed
                      if (!Dom.hasElData(elem)) return;
                    
                      let data = Dom.getElData(elem);
                    Severity: Minor
                    Found in src/js/utils/events.js - About 1 hr to fix

                      Function src has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        src(source) {
                          if (source === undefined) {
                            return this.techGet_('src');
                          }
                      
                      
                      Severity: Minor
                      Found in src/js/player.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 handleKeyPress has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        handleKeyPress(event) {
                      
                          // Escape (27) key or Tab (9) key unpress the 'button'
                          if (event.which === 27 || event.which === 9) {
                            if (this.buttonPressed_) {
                      Severity: Minor
                      Found in src/js/menu/menu-button.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

                      Severity
                      Category
                      Status
                      Source
                      Language