harella1/video.js

View on GitHub

Showing 221 of 221 total issues

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

  constructor(tracks = []) {
    let list;

    // make sure only 1 track is enabled
    // sorted from last index to first index
Severity: Minor
Found in src/js/tracks/audio-track-list.js - About 1 hr 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 14 (exceeds 5 allowed). Consider refactoring.
Open

export function off(elem, type, fn) {
  // Don't want to add a cache object through getElData if not needed
  if (!Dom.hasElData(elem)) return;

  let data = Dom.getElData(elem);
Severity: Minor
Found in src/js/utils/events.js - About 1 hr 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 a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  loadTech_(techName, source) {

    // Pause and remove current playback technology
    if (this.tech_) {
      this.unloadTech_();
Severity: Minor
Found in src/js/player.js - About 1 hr 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 FlashRtmpDecorator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function FlashRtmpDecorator(Flash) {
  Flash.streamingFormats = {
    'rtmp/mp4': 'MP4',
    'rtmp/flv': 'FLV'
  };
Severity: Minor
Found in src/js/tech/flash-rtmp.js - About 1 hr 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 createEl has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  createEl() {
    let el = this.el_ = super.createEl('div');
    let tag = this.tag;

    // Remove width/height attrs from tag so CSS can make it 100% width/height
Severity: Minor
Found in src/js/player.js - About 1 hr to fix

    Function handleLateInit_ has 40 lines of code (exceeds 25 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 1 hr to fix

      Function createMenu has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        createMenu() {
          let tracks = this.player_.textTracks() || [];
          let chaptersTrack;
          let items = this.items = [];
      
      
      Severity: Minor
      Found in src/js/control-bar/text-track-controls/chapters-button.js - About 1 hr 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 39 lines of code (exceeds 25 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 1 hr to fix

        Function emitTapEvents has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          emitTapEvents() {
            // Track the start time so we can determine how long the touch lasted
            let touchStart = 0;
            let firstTouch = null;
        
        
        Severity: Minor
        Found in src/js/component.js - About 1 hr to fix

          Function addChild has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            addChild(child, options={}, index=this.children_.length) {
              let component;
              let componentName;
          
              // If child is a string, create nt with options
          Severity: Minor
          Found in src/js/component.js - About 1 hr to fix

            Function constructor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              constructor(options = {}) {
                super();
            
                let readyState,
                    trackElement = this;
            Severity: Minor
            Found in src/js/tracks/html-track-element.js - About 1 hr to fix

              Function selectSource has 38 lines of code (exceeds 25 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 1 hr to fix

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

                    if (tracks) {
                      let changeHandler = Fn.bind(this, this.handleTracksChange);
                
                      tracks.addEventListener('change', changeHandler);
                      this.on('dispose', function() {
                src/js/control-bar/text-track-controls/text-track-menu-item.js on lines 32..39

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

                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 (let i = tracks.length - 1; i >= 0; i--) {
                      if (tracks[i].selected) {
                        disableOthers(tracks, tracks[i]);
                        break;
                      }
                Severity: Major
                Found in src/js/tracks/video-track-list.js and 1 other location - About 1 hr to fix
                src/js/tracks/audio-track-list.js on lines 49..54

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

                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

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

                    if (tracks) {
                      let changeHandler = Fn.bind(this, this.handleTracksChange);
                
                      tracks.addEventListener('change', changeHandler);
                      this.on('dispose', function() {
                src/js/control-bar/text-track-controls/descriptions-button.js on lines 25..32

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

                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 (let i = tracks.length - 1; i >= 0; i--) {
                      if (tracks[i].enabled) {
                        disableOthers(tracks, tracks[i]);
                        break;
                      }
                Severity: Major
                Found in src/js/tracks/audio-track-list.js and 1 other location - About 1 hr to fix
                src/js/tracks/video-track-list.js on lines 51..56

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

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

                  constructor(player, options, ready){
                    super(player, options, ready);
                
                    player.on('loadstart', Fn.bind(this, this.toggleDisplay));
                    player.on('texttrackchange', Fn.bind(this, this.updateDisplay));
                Severity: Minor
                Found in src/js/tracks/text-track-display.js - About 1 hr to fix

                  Function constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    constructor(player, options={}){
                      // Default to inline
                      if (options.inline === undefined) {
                        options.inline = true;
                      }
                  Severity: Minor
                  Found in src/js/control-bar/volume-menu-button.js - About 1 hr to fix

                    Function emulateTextTracks has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      emulateTextTracks() {
                        let tracks = this.textTracks();
                        if (!tracks) {
                          return;
                        }
                    Severity: Minor
                    Found in src/js/tech/tech.js - About 1 hr to fix

                      Function patchCanPlayType has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      Html5.patchCanPlayType = function() {
                        // Android 4.0 and above can play HLS to some extent but it reports being unable to do so
                        if (browser.ANDROID_VERSION >= 4.0) {
                          if (!canPlayType) {
                            canPlayType = Html5.TEST_VID.constructor.prototype.canPlayType;
                      Severity: Minor
                      Found in src/js/tech/html5.js - About 1 hr 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