harella1/video.js

View on GitHub

Showing 221 of 221 total issues

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

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

        for (let name in props) {
          if (props.hasOwnProperty(name)) {
            subObj.prototype[name] = props[name];
          }
        }
    Severity: Minor
    Found in src/js/component.js and 1 other location - About 40 mins to fix
    src/js/extend.js on lines 69..73

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

    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

      for (var name in methods) {
        if (methods.hasOwnProperty(name)) {
          subClass.prototype[name] = methods[name];
        }
      }
    Severity: Minor
    Found in src/js/extend.js and 1 other location - About 40 mins to fix
    src/js/component.js on lines 1452..1456

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

    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

          if (this.closeable()) {
            this.on(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));
          }
    Severity: Minor
    Found in src/js/modal-dialog.js and 1 other location - About 40 mins to fix
    src/js/modal-dialog.js on lines 221..223

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

    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

          if (this.closeable()) {
            this.off(this.el_.ownerDocument, 'keydown', Fn.bind(this, this.handleKeyPress));
          }
    Severity: Minor
    Found in src/js/modal-dialog.js and 1 other location - About 40 mins to fix
    src/js/modal-dialog.js on lines 175..177

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

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

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

            if (selected) {
              this.addClass('vjs-selected');
              this.el_.setAttribute('aria-checked','true');
              // aria-checked isn't fully supported by browsers/screen readers,
              // so indicate selected state to screen reader in the control text.
      Severity: Minor
      Found in src/js/menu/menu-item.js and 1 other location - About 35 mins to fix
      src/js/menu/menu-item.js on lines 73..79

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

      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

            } else {
              this.removeClass('vjs-selected');
              this.el_.setAttribute('aria-checked','false');
              // Indicate un-selected state to screen reader
              // Note that a space clears out the selected state text
      Severity: Minor
      Found in src/js/menu/menu-item.js and 1 other location - About 35 mins to fix
      src/js/menu/menu-item.js on lines 67..73

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

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