harella1/video.js

View on GitHub

Showing 139 of 221 total issues

Function addRemoteTextTrack has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  addRemoteTextTrack(options={}) {
    if (!this['featuresNativeTextTracks']) {
      return super.addRemoteTextTrack(options);
    }

Severity: Minor
Found in src/js/tech/html5.js - About 45 mins 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 formatTime has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

function formatTime(seconds, guide=seconds) {
  seconds = seconds < 0 ? 0 : seconds;
  let s = Math.floor(seconds % 60);
  let m = Math.floor(seconds / 60 % 60);
  let h = Math.floor(seconds / 3600);
Severity: Minor
Found in src/js/utils/format-time.js - About 45 mins 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 8 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(trackElements = []) {
    let list = this;

    if (browser.IS_IE8) {
      list = document.createElement('custom');
Severity: Minor
Found in src/js/tracks/html-track-element-list.js - About 45 mins 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 removeChild has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  removeChild(component) {
    if (typeof component === 'string') {
      component = this.getChild(component);
    }

Severity: Minor
Found in src/js/component.js - About 45 mins 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 handleLateInit_ has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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

Avoid deeply nested control flow statements.
Open

          if (options !== null) {
            // Create new video.js instance.
            let player = videojs(mediaEl);
          }
Severity: Major
Found in src/js/setup.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                if (!crossoriginTracks &&
                    !this.el_.hasAttribute('crossorigin') &&
                    Url.isCrossOrigin(node.src)) {
                  crossoriginTracks = true;
                }
    Severity: Major
    Found in src/js/tech/html5.js - About 45 mins to fix

      Function createTrackHelper has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      var createTrackHelper = function(self, kind, label, language, options={}) {
      Severity: Minor
      Found in src/js/tech/tech.js - About 35 mins to fix

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

          constructor(options = {}) {
            super();
        
            let readyState,
                trackElement = this;
        Severity: Minor
        Found in src/js/tracks/html-track-element.js - About 35 mins 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 removeTrack_ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          removeTrack_(rtrack) {
            let track;
        
            for (let i = 0, l = this.length; i < l; i++) {
              if (this[i] === rtrack) {
        Severity: Minor
        Found in src/js/tracks/track-list.js - About 35 mins 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 usingNativeControls has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          usingNativeControls(bool) {
            if (bool !== undefined) {
              bool = !!bool; // force boolean
              // Don't trigger a change event unless it actually changed
              if (this.usingNativeControls_ !== bool) {
        Severity: Minor
        Found in src/js/player.js - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          update() {
            let buffered = this.player_.buffered();
            let duration = this.player_.duration();
            let bufferedEnd = this.player_.bufferedEnd();
            let children = this.el_.children;
        Severity: Minor
        Found in src/js/control-bar/progress-control/load-progress-bar.js - About 35 mins 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 disposeMediaElement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        Html5.disposeMediaElement = function(el){
          if (!el) { return; }
        
          if (el.parentNode) {
            el.parentNode.removeChild(el);
        Severity: Minor
        Found in src/js/tech/html5.js - About 35 mins 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 update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          update() {
            var vol = this.player_.volume(),
                level = 3;
        
            if (vol === 0 || this.player_.muted()) {
        Severity: Minor
        Found in src/js/control-bar/mute-toggle.js - About 35 mins 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 handleClick has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          handleClick(event) {
            let kind = this.track['kind'];
            let tracks = this.player_.textTracks();
        
            super.handleClick(event);
        Severity: Minor
        Found in src/js/control-bar/text-track-controls/text-track-menu-item.js - About 35 mins 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 7 (exceeds 5 allowed). Consider refactoring.
        Open

          constructor(cues) {
            let list = this;
        
            if (browser.IS_IE8) {
              list = document.createElement('custom');
        Severity: Minor
        Found in src/js/tracks/text-track-cue-list.js - About 35 mins 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 close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          close() {
            if (this.opened_) {
              let player = this.player();
        
              this.trigger('beforemodalclose');
        Severity: Minor
        Found in src/js/modal-dialog.js - About 35 mins 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 hasStarted has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          hasStarted(hasStarted) {
            if (hasStarted !== undefined) {
              // only update if this is a new value
              if (this.hasStarted_ !== hasStarted) {
                this.hasStarted_ = hasStarted;
        Severity: Minor
        Found in src/js/player.js - About 35 mins 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 removeTrack_ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          removeTrack_(rtrack) {
            let track;
        
            for (let i = 0, l = this.length; i < l; i++) {
              if (this[i] === rtrack) {
        Severity: Minor
        Found in src/js/tracks/text-track-list.js - About 35 mins 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