Showing 91 of 331 total issues
Function _getVASTAd
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
VASTClient.prototype._getVASTAd = function (adTagUrl, callback) {
var that = this;
getAdWaterfall(adTagUrl, function (error, vastTree) {
var waterfallAds = vastTree && utilities.isArray(vastTree.ads) ? vastTree.ads : null;
- 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 run
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
HttpRequest.prototype.run = function (method, url, callback, options) {
sanityCheck(url, callback, options);
var timeout, timeoutId;
var xhr = this.createXhr();
options = options || {};
- 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 trackProgress
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
VASTTracker.prototype.trackProgress = function trackProgress(newProgressInMs) {
var that = this;
var events = [];
var ONCE = true;
var ALWAYS = false;
File http.spec.js
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
var HttpRequest = require('utils/http').HttpRequest;
var HttpRequestError = require('utils/http').HttpRequestError;
var utilities = require('utils/utilityFunctions');
var testUtils = require('../test-utils');
Function run
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
HttpRequest.prototype.run = function (method, url, callback, options) {
sanityCheck(url, callback, options);
var timeout, timeoutId;
var xhr = this.createXhr();
options = options || {};
Function playVPaidAd
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
VPAIDIntegrator.prototype.playAd = function playVPaidAd(vastResponse, callback) {
if (!(vastResponse instanceof VASTResponse)) {
return callback(new VASTError('on VASTIntegrator.playAd, missing required VASTResponse'));
}
File VASTIntegrator.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/**
* Inner helper class that deals with the logic of the individual steps needed to setup an ad in the player.
*
Function restorePlayerSnapshot
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
playerUtils.restorePlayerSnapshot = function restorePlayerSnapshot(player, snapshot) {
var tech = player.el().querySelector('.vjs-tech');
var attempts = 20; // the number of remaining attempts to restore the snapshot
if (snapshot.nativePoster) {
Function playAd
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
function playAd(vastResponse, callback) {
//TODO: Find a better way to stop the play. The 'playPrerollWaterfall' ends in an inconsistent situation
//If the state is not 'preroll?' it means the ads were canceled therefore, we break the waterfall
if (adsCanceled) {
return;
Function Linear
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
function Linear(linearJTree) {
if (!(this instanceof Linear)) {
return new Linear(linearJTree);
}
- 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 setupEvents
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
VASTIntegrator.prototype._setupEvents = function setupEvents(adMediaFile, tracker, response, callback) {
var previouslyMuted;
var player = this.player;
player.on('fullscreenchange', trackFullscreenChange);
player.on('vast.adStart', trackImpressions);
File utilityFunctions.js
has 256 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*jshint unused:false */
"use strict";
var NODE_TYPE_ELEMENT = 1;
var SNAKE_CASE_REGEXP = /[A-Z]/g;
Function Companion
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Companion(companionJTree) {
if (!(this instanceof Companion)) {
return new Companion(companionJTree);
}
Function addSkipButton
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
VASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {
var skipOffsetInSec;
var that = this;
if (utilities.isNumber(response.skipoffset)) {
Function addSkipButton
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
VASTIntegrator.prototype._addSkipButton = function addSkipButton(source, tracker, response, callback) {
var skipOffsetInSec;
var that = this;
if (utilities.isNumber(response.skipoffset)) {
- 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 removeClass
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
dom.removeClass = function (el, cssClass) {
var classes;
if (utilities.isNotEmptyString(cssClass)) {
if (el.classList) {
- 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 addClickThrough
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
VASTIntegrator.prototype._addClickThrough = function addClickThrough(mediaFile, tracker, response, callback) {
var player = this.player;
var blocker = createClickThroughBlocker(player, tracker, response);
var updateBlocker = updateBlockerURL.bind(this, blocker, response, player);
Function FakeAdUnit
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function FakeAdUnit() {
var events = {};
this.options = {
src: 'fakeSrc'
};
Function _addSkipButton
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
VPAIDIntegrator.prototype._addSkipButton = function (adUnit, vastResponse, next) {
var skipButton;
var player = this.player;
adUnit.on('AdSkippableStateChange', updateSkipButtonState);
Function monkeyPatchPlayerApi
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function monkeyPatchPlayerApi() {
/**
* Monkey patch needed to handle firstPlay and resume of playing ad.
*