harella1/video.js

View on GitHub

Showing 221 of 221 total issues

Tech has 34 functions (exceeds 20 allowed). Consider refactoring.
Open

class Tech extends Component {

  constructor(options={}, ready=function(){}){
    // we don't want the tech to report user activity automatically.
    // This is done manually in addControlsListeners
Severity: Minor
Found in src/js/tech/tech.js - About 4 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if (event.clientX != null) {
          var doc = document.documentElement, body = document.body;
    
          event.pageX = event.clientX +
            (doc && doc.scrollLeft || body && body.scrollLeft || 0) -
    Severity: Critical
    Found in src/js/utils/events.js - About 4 hrs to fix

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

        constructor(options, ready){
          super(options, ready);
      
          const source = options.source;
          let crossoriginTracks = false;
      Severity: Minor
      Found in src/js/tech/html5.js - About 4 hrs 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

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

        handleKeyPress(event) {
          if (event.which === 37 || event.which === 40) { // Left and Down Arrows
            event.preventDefault();
            this.stepBack();
          } else if (event.which === 38 || event.which === 39) { // Up and Right Arrows
      Severity: Major
      Found in src/js/slider/slider.js and 1 other location - About 3 hrs to fix
      src/js/menu/menu.js on lines 75..83

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

      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

        handleKeyPress (event) {
          if (event.which === 37 || event.which === 40) { // Left and Down Arrows
            event.preventDefault();
            this.stepForward();
          } else if (event.which === 38 || event.which === 39) { // Up and Right Arrows
      Severity: Major
      Found in src/js/menu/menu.js and 1 other location - About 3 hrs to fix
      src/js/slider/slider.js on lines 181..189

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

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

      Tech.withSourceHandlers = function(_Tech){
         /*
          * Register a source handler
          * Source handlers are scripts for handling specific formats.
          * The source handler pattern is used for adaptive formats (HLS, DASH) that
      Severity: Major
      Found in src/js/tech/tech.js - About 3 hrs to fix

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

          createEl() {
            let el = super.createEl('div', {
              className: 'vjs-duration vjs-time-control vjs-control'
            });
        
        
        Severity: Major
        Found in src/js/control-bar/time-controls/duration-display.js and 1 other location - About 3 hrs to fix
        src/js/control-bar/time-controls/remaining-time-display.js on lines 30..46

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

        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

          createEl() {
            let el = super.createEl('div', {
              className: 'vjs-remaining-time vjs-time-control vjs-control'
            });
        
        
        Severity: Major
        Found in src/js/control-bar/time-controls/remaining-time-display.js and 1 other location - About 3 hrs to fix
        src/js/control-bar/time-controls/duration-display.js on lines 36..52

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

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

          updateStyleEl_() {
            if (window.VIDEOJS_NO_DYNAMIC_STYLE === true) {
              const width = typeof this.width_ === 'number' ? this.width_ : this.options_.width;
              const height = typeof this.height_ === 'number' ? this.height_ : this.options_.height;
              let techEl = this.tech_ && this.tech_.el();
        Severity: Minor
        Found in src/js/player.js - About 3 hrs 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 on has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        export function on(elem, type, fn){
          if (Array.isArray(type)) {
            return _handleMultipleEvents(on, elem, type, fn);
          }
        
        
        Severity: Minor
        Found in src/js/utils/events.js - About 3 hrs 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 autoSetup has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

        var autoSetup = function(){
          // One day, when we stop supporting IE8, go back to this, but in the meantime...*hack hack hack*
          // var vids = Array.prototype.slice.call(document.getElementsByTagName('video'));
          // var audios = Array.prototype.slice.call(document.getElementsByTagName('audio'));
          // var mediaEls = vids.concat(audios);
        Severity: Minor
        Found in src/js/setup.js - About 3 hrs 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 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          loadTech_(techName, source) {
        
            // Pause and remove current playback technology
            if (this.tech_) {
              this.unloadTech_();
        Severity: Major
        Found in src/js/player.js - About 3 hrs to fix

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

            if (browser.IS_OLD_ANDROID) {
              if (!canPlayType) {
                canPlayType = Html5.TEST_VID.constructor.prototype.canPlayType;
              }
          
          
          Severity: Major
          Found in src/js/tech/html5.js and 1 other location - About 3 hrs to fix
          src/js/tech/html5.js on lines 1159..1170

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

          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 (browser.ANDROID_VERSION >= 4.0) {
              if (!canPlayType) {
                canPlayType = Html5.TEST_VID.constructor.prototype.canPlayType;
              }
          
          
          Severity: Major
          Found in src/js/tech/html5.js and 1 other location - About 3 hrs to fix
          src/js/tech/html5.js on lines 1173..1184

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

          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

            static getTech(name) {
              if (Tech.techs_ && Tech.techs_[name]) {
                return Tech.techs_[name];
              }
          
          
          Severity: Major
          Found in src/js/tech/tech.js and 1 other location - About 3 hrs to fix
          src/js/component.js on lines 1400..1409

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

          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

            static getComponent(name) {
              if (Component.components_ && Component.components_[name]) {
                return Component.components_[name];
              }
          
          
          Severity: Major
          Found in src/js/component.js and 1 other location - About 3 hrs to fix
          src/js/tech/tech.js on lines 605..614

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

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

            constructor(tag, options, ready){
              // Make sure tag ID exists
              tag.id = tag.id || `vjs_video_${Guid.newGUID()}`;
          
              // Set Options
          Severity: Major
          Found in src/js/player.js - About 2 hrs to fix

            Function updateForTrack has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              updateForTrack(track) {
                if (typeof window['WebVTT'] !== 'function' || !track['activeCues']) {
                  return;
                }
            
            
            Severity: Major
            Found in src/js/tracks/text-track-display.js - About 2 hrs to fix

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

              const disableOthers = function(list, track) {
                for (let i = 0; i < list.length; i++) {
                  if (track.id === list[i].id) {
                    continue;
                  }
              Severity: Major
              Found in src/js/tracks/audio-track-list.js and 1 other location - About 2 hrs to fix
              src/js/tracks/video-track-list.js on lines 14..22

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

              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

              const disableOthers = function(list, track) {
                for (let i = 0; i < list.length; i++) {
                  if (track.id === list[i].id) {
                    continue;
                  }
              Severity: Major
              Found in src/js/tracks/video-track-list.js and 1 other location - About 2 hrs to fix
              src/js/tracks/audio-track-list.js on lines 15..23

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

              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

              Severity
              Category
              Status
              Source
              Language