harella1/video.js

View on GitHub

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

                    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

                      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

                        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

                            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

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language