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';
Player
has 111 functions (exceeds 20 allowed). Consider refactoring. Open
class Player extends Component {
/**
* player's constructor function
*
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');
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; }
- Read upRead up
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
*/
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
*/
Html5
has 61 functions (exceeds 20 allowed). Consider refactoring. Open
class Html5 extends Tech {
constructor(options, ready){
super(options, ready);
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
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.');
}
- Read upRead up
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');
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
*/
Function updateForTrack
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
updateForTrack(track) {
if (typeof window['WebVTT'] !== 'function' || !track['activeCues']) {
return;
}
- Read upRead up
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>
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
- Read upRead up
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.');
}
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
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) -
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;
- Read upRead up
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
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();
- Read upRead up
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"