harella1/video.js

View on GitHub

Showing 139 of 221 total issues

Function constructor has a Cognitive Complexity of 14 (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/audio-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 off has a Cognitive Complexity of 14 (exceeds 5 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

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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  loadTech_(techName, source) {

    // Pause and remove current playback technology
    if (this.tech_) {
      this.unloadTech_();
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 FlashRtmpDecorator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function FlashRtmpDecorator(Flash) {
  Flash.streamingFormats = {
    'rtmp/mp4': 'MP4',
    'rtmp/flv': 'FLV'
  };
Severity: Minor
Found in src/js/tech/flash-rtmp.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 createEl has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createEl() {
    let el = this.el_ = super.createEl('div');
    let tag = this.tag;

    // Remove width/height attrs from tag so CSS can make it 100% width/height
Severity: Minor
Found in src/js/player.js - About 1 hr to fix

    Function handleLateInit_ has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      handleLateInit_(el) {
        if (el.networkState === 0 || el.networkState === 3) {
          // The video element hasn't started loading the source yet
          // or didn't find a source
          return;
    Severity: Minor
    Found in src/js/tech/html5.js - About 1 hr to fix

      Function createMenu has a Cognitive Complexity of 13 (exceeds 5 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

      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 listenForUserActivity_ has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        listenForUserActivity_() {
          let mouseInProgress, lastMoveX, lastMoveY;
      
          let handleActivity = Fn.bind(this, this.reportUserActivity);
      
      
      Severity: Minor
      Found in src/js/player.js - About 1 hr to fix

        Function emitTapEvents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          emitTapEvents() {
            // Track the start time so we can determine how long the touch lasted
            let touchStart = 0;
            let firstTouch = null;
        
        
        Severity: Minor
        Found in src/js/component.js - About 1 hr to fix

          Function addChild has 38 lines of code (exceeds 25 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

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

              constructor(options = {}) {
                super();
            
                let readyState,
                    trackElement = this;
            Severity: Minor
            Found in src/js/tracks/html-track-element.js - About 1 hr to fix

              Function selectSource has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                selectSource(sources) {
                  // Get only the techs specified in `techOrder` that exist and are supported by the
                  // current platform
                  let techs =
                    this.options_.techOrder
              Severity: Minor
              Found in src/js/player.js - About 1 hr to fix

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

                  constructor(player, options, ready){
                    super(player, options, ready);
                
                    player.on('loadstart', Fn.bind(this, this.toggleDisplay));
                    player.on('texttrackchange', Fn.bind(this, this.updateDisplay));
                Severity: Minor
                Found in src/js/tracks/text-track-display.js - About 1 hr to fix

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

                    constructor(player, options={}){
                      // Default to inline
                      if (options.inline === undefined) {
                        options.inline = true;
                      }
                  Severity: Minor
                  Found in src/js/control-bar/volume-menu-button.js - About 1 hr to fix

                    Function emulateTextTracks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      emulateTextTracks() {
                        let tracks = this.textTracks();
                        if (!tracks) {
                          return;
                        }
                    Severity: Minor
                    Found in src/js/tech/tech.js - About 1 hr to fix

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

                      Html5.patchCanPlayType = function() {
                        // Android 4.0 and above can play HLS to some extent but it reports being unable to do so
                        if (browser.ANDROID_VERSION >= 4.0) {
                          if (!canPlayType) {
                            canPlayType = Html5.TEST_VID.constructor.prototype.canPlayType;
                      Severity: Minor
                      Found in src/js/tech/html5.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 trigger has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function trigger(elem, event, hash) {
                        // Fetches element data and a reference to the parent (for bubbling).
                        // Don't want to add a data object to cache for every parent,
                        // so checking hasElData first.
                        var elemData = (Dom.hasElData(elem)) ? Dom.getElData(elem) : {};
                      Severity: Minor
                      Found in src/js/utils/events.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 getElAttributes has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function getElAttributes(tag) {
                        var obj, knownBooleans, attrs, attrName, attrVal;
                      
                        obj = {};
                      
                      
                      Severity: Minor
                      Found in src/js/utils/dom.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 createEl has a Cognitive Complexity of 12 (exceeds 5 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

                      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 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                        constructor(player, options, ready){
                          super(player, options, ready);
                      
                          // If there are no sources when the player is initialized,
                          // load the first supported playback technology.
                      Severity: Minor
                      Found in src/js/tech/loader.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