harella1/video.js

View on GitHub

Showing 139 of 221 total issues

Function on has a Cognitive Complexity of 25 (exceeds 5 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 3 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 autoSetup has a Cognitive Complexity of 25 (exceeds 5 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 3 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 loadTech_ has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  loadTech_(techName, source) {

    // Pause and remove current playback technology
    if (this.tech_) {
      this.unloadTech_();
Severity: Major
Found in src/js/player.js - About 3 hrs to fix

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

      constructor(tag, options, ready){
        // Make sure tag ID exists
        tag.id = tag.id || `vjs_video_${Guid.newGUID()}`;
    
        // Set Options
    Severity: Major
    Found in src/js/player.js - About 2 hrs to fix

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

        updateForTrack(track) {
          if (typeof window['WebVTT'] !== 'function' || !track['activeCues']) {
            return;
          }
      
      
      Severity: Major
      Found in src/js/tracks/text-track-display.js - About 2 hrs to fix

        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

            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

                      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

                        Function videojs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                        let videojs = function(id, options, ready){
                          let tag; // Element of ID
                        
                          // Allow for element or ID to be passed in
                          // String ID
                        Severity: Minor
                        Found in src/js/video.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 initChildren has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                        Open

                          initChildren() {
                            let children = this.options_.children;
                        
                            if (children) {
                              // `this` is `parent`
                        Severity: Minor
                        Found in src/js/component.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 constructor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                          constructor(tag, options, ready){
                            // Make sure tag ID exists
                            tag.id = tag.id || `vjs_video_${Guid.newGUID()}`;
                        
                            // Set Options
                        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 addChild has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                          addChild(child, options={}, index=this.children_.length) {
                            let component;
                            let componentName;
                        
                            // If child is a string, create nt with options
                        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 createMenu has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          createMenu() {
                            let tracks = this.player_.textTracks() || [];
                            let chaptersTrack;
                            let items = this.items = [];
                        
                        
                        Severity: Minor
                        Found in src/js/control-bar/text-track-controls/chapters-button.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language