harella1/video.js

View on GitHub

Showing 221 of 221 total issues

File player.js has 1220 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * @file player.js
 */
 // Subclasses Component
import Component from './component.js';
Severity: Major
Found in src/js/player.js - About 3 days to fix

    Player has 111 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Player extends Component {
    
      /**
       * player's constructor function
       *
    Severity: Major
    Found in src/js/player.js - About 2 days to fix

      Function exports has 421 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(grunt) {
        require('time-grunt')(grunt);
      
        let _ = require('lodash-compat');
        let pkg = grunt.file.readJSON('package.json');
      Severity: Major
      Found in build/grunt.js - About 2 days to fix

        Function fixEvent has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
        Open

        export function fixEvent(event) {
        
          function returnTrue() { return true; }
          function returnFalse() { return false; }
        
        
        Severity: Minor
        Found in src/js/utils/events.js - About 1 day 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

        File component.js has 556 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * @file component.js
         *
         * Player Component - Base class for all UI objects
         */
        Severity: Major
        Found in src/js/component.js - About 1 day to fix

          File html5.js has 552 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @file html5.js
           * HTML5 Media Controller - Wrapper for HTML5 Media API
           */
          
          
          Severity: Major
          Found in src/js/tech/html5.js - About 1 day to fix

            Html5 has 61 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class Html5 extends Tech {
            
              constructor(options, ready){
                super(options, ready);
            
            
            Severity: Major
            Found in src/js/tech/html5.js - About 1 day to fix

              Component has 50 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Component {
              
                constructor(player, options, ready) {
              
                  // The component might be the player itself and we can't pass `this` to super
              Severity: Minor
              Found in src/js/component.js - About 7 hrs to fix

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

                  constructor(options = {}) {
                    if (!options.tech) {
                      throw new Error('A tech was not provided.');
                    }
                
                
                Severity: Minor
                Found in src/js/tracks/text-track.js - About 6 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

                File grunt.js has 424 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {gruntCustomizer, gruntOptionsMaker} from './options-customizer.js';
                module.exports = function(grunt) {
                  require('time-grunt')(grunt);
                
                  let _ = require('lodash-compat');
                Severity: Minor
                Found in build/grunt.js - About 6 hrs to fix

                  File tech.js has 405 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  /**
                   * @file tech.js
                   * Media Technology Controller - Base class for media playback
                   * technology controllers like Flash and HTML5
                   */
                  Severity: Minor
                  Found in src/js/tech/tech.js - About 5 hrs to fix

                    Function updateForTrack has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                    Open

                      updateForTrack(track) {
                        if (typeof window['WebVTT'] !== 'function' || !track['activeCues']) {
                          return;
                        }
                    
                    
                    Severity: Minor
                    Found in src/js/tracks/text-track-display.js - About 5 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

                      removeTrack_(rtrack) {
                        let track;
                    
                        for (let i = 0, l = this.length; i < l; i++) {
                          if (this[i] === rtrack) {
                    Severity: Major
                    Found in src/js/tracks/text-track-list.js and 1 other location - About 5 hrs to fix
                    src/js/tracks/track-list.js on lines 83..107

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

                    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

                      removeTrack_(rtrack) {
                        let track;
                    
                        for (let i = 0, l = this.length; i < l; i++) {
                          if (this[i] === rtrack) {
                    Severity: Major
                    Found in src/js/tracks/track-list.js and 1 other location - About 5 hrs to fix
                    src/js/tracks/text-track-list.js on lines 67..91

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

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

                    function captionOptionsMenuTemplate() {
                      let template = `<div class="vjs-tracksettings">
                          <div class="vjs-tracksettings-colors">
                            <div class="vjs-fg-color vjs-tracksetting">
                                <label class="vjs-label">Foreground</label>
                    Severity: Major
                    Found in src/js/tracks/text-track-settings.js - About 4 hrs to fix

                      Function withSourceHandlers has a Cognitive Complexity of 30 (exceeds 5 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: Minor
                      Found in src/js/tech/tech.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 3 locations. Consider refactoring.
                      Open

                          if (browser.IS_IE8) {
                            list = document.createElement('custom');
                            for (let prop in TrackList.prototype) {
                              if (prop !== 'constructor') {
                                list[prop] = TrackList.prototype[prop];
                      Severity: Major
                      Found in src/js/tracks/audio-track-list.js and 2 other locations - About 4 hrs to fix
                      src/js/tracks/text-track-list.js on lines 34..46
                      src/js/tracks/video-track-list.js on lines 60..72

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

                      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 3 locations. Consider refactoring.
                      Open

                          if (browser.IS_IE8) {
                            list = document.createElement('custom');
                            for (let prop in TrackList.prototype) {
                              if (prop !== 'constructor') {
                                list[prop] = TrackList.prototype[prop];
                      Severity: Major
                      Found in src/js/tracks/text-track-list.js and 2 other locations - About 4 hrs to fix
                      src/js/tracks/audio-track-list.js on lines 58..70
                      src/js/tracks/video-track-list.js on lines 60..72

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

                      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 3 locations. Consider refactoring.
                      Open

                          if (browser.IS_IE8) {
                            list = document.createElement('custom');
                            for (let prop in TrackList.prototype) {
                              if (prop !== 'constructor') {
                                list[prop] = TrackList.prototype[prop];
                      Severity: Major
                      Found in src/js/tracks/video-track-list.js and 2 other locations - About 4 hrs to fix
                      src/js/tracks/audio-track-list.js on lines 58..70
                      src/js/tracks/text-track-list.js on lines 34..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 123.

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

                        constructor(options = {}) {
                          if (!options.tech) {
                            throw new Error('A tech was not provided.');
                          }
                      
                      
                      Severity: Major
                      Found in src/js/tracks/text-track.js - About 4 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language