harella1/video.js

View on GitHub

Showing 139 of 221 total issues

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

  on(first, second, third) {
    if (typeof first === 'string' || Array.isArray(first)) {
      Events.on(this.el_, first, Fn.bind(this, second));

    // Targeting another component or element
Severity: Minor
Found in src/js/component.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 dispose has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  dispose() {
    this.trigger({ type: 'dispose', bubbles: false });

    // Dispose all children.
    if (this.children_) {
Severity: Minor
Found in src/js/component.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

Avoid too many return statements within this function.
Open

    return;
Severity: Major
Found in src/js/utils/events.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

      if (!handlers) return;
    Severity: Major
    Found in src/js/utils/events.js - About 30 mins to fix

      Function handleTracksChange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        handleTracksChange(event){
          let tracks = this.player().textTracks();
          let disabled = false;
      
          // Check whether a track of a different kind is showing
      Severity: Minor
      Found in src/js/control-bar/text-track-controls/descriptions-button.js - About 25 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 dimension has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        dimension(dimension, value) {
          let privDimension = dimension + '_';
      
          if (value === undefined) {
            return this[privDimension] || 0;
      Severity: Minor
      Found in src/js/player.js - About 25 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 selectSource has a Cognitive Complexity of 6 (exceeds 5 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 25 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 addCue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        addCue(cue) {
          let tracks = this.tech_.textTracks();
      
          if (tracks) {
            for (let i = 0; i < tracks.length; i++) {
      Severity: Minor
      Found in src/js/tracks/text-track.js - About 25 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 off has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        off(first, second, third) {
          if (!first || typeof first === 'string' || Array.isArray(first)) {
            Events.off(this.el_, first, second);
          } else {
            const target = first;
      Severity: Minor
      Found in src/js/component.js - About 25 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 setCues_ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        setCues_(cues) {
          let oldLength = this.length || 0;
          let i = 0;
          let l = cues.length;
      
      
      Severity: Minor
      Found in src/js/tracks/text-track-cue-list.js - About 25 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 _cleanUpEvents has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      function _cleanUpEvents(elem, type) {
        var data = Dom.getElData(elem);
      
        // Remove the events of a particular type if there are none left
        if (data.handlers[type].length === 0) {
      Severity: Minor
      Found in src/js/utils/events.js - About 25 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 localize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        localize(string) {
          let code = this.player_.language && this.player_.language();
          let languages = this.player_.languages && this.player_.languages();
      
          if (!code || !languages) {
      Severity: Minor
      Found in src/js/component.js - About 25 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 requestFullscreen has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        requestFullscreen() {
          var fsApi = FullscreenApi;
      
          this.isFullscreen(true);
      
      
      Severity: Minor
      Found in src/js/player.js - About 25 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 duration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        duration(seconds) {
          if (seconds === undefined) {
            return this.cache_.duration || 0;
          }
      
      
      Severity: Minor
      Found in src/js/player.js - About 25 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 focus has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        focus (item = 0) {
          let children = this.children().slice();
          let haveTitle = children.length && children[0].className &&
            /vjs-menu-title/.test(children[0].className);
      
      
      Severity: Minor
      Found in src/js/menu/menu.js - About 25 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 version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      Flash.version = function(){
        let version = '0,0,0';
      
        // IE
        try {
      Severity: Minor
      Found in src/js/tech/flash.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
      Open

        update() {
          // In VolumeBar init we have a setTimeout for update that pops and update to the end of the
          // execution stack. The player is destroyed before then update will cause an error
          if (!this.el_) return;
      
      
      Severity: Minor
      Found in src/js/slider/slider.js - About 25 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 parseUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export const parseUrl = function(url) {
        const props = ['protocol', 'hostname', 'port', 'pathname', 'search', 'hash', 'host'];
      
        // add the url to an anchor and let the browser parse the URL
        let a = document.createElement('a');
      Severity: Minor
      Found in src/js/utils/url.js - About 25 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 bufferedPercent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      export function bufferedPercent(buffered, duration) {
        var bufferedDuration = 0,
            start, end;
      
        if (!duration) {
      Severity: Minor
      Found in src/js/utils/buffer.js - About 25 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