harella1/video.js

View on GitHub

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

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

    export function isTextNode(value) {
      return !!value && typeof value === 'object' && value.nodeType === 3;
    }
    Severity: Minor
    Found in src/js/utils/dom.js and 1 other location - About 30 mins to fix
    src/js/utils/dom.js on lines 502..504

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

    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

    export function isEl(value) {
      return !!value && typeof value === 'object' && value.nodeType === 1;
    }
    Severity: Minor
    Found in src/js/utils/dom.js and 1 other location - About 30 mins to fix
    src/js/utils/dom.js on lines 512..514

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

    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

    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

      Severity
      Category
      Status
      Source
      Language