File eplanningBidAdapter.js
has 470 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {getWindowSelf, isEmpty, parseSizesInput, isGptPubadsDefined} from '../src/utils.js';
import {getGlobal} from '../src/prebidGlobal.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {getStorageManager} from '../src/storageManager.js';
import {BANNER, VIDEO} from '../src/mediaTypes.js';
Function buildRequests
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
buildRequests: function(bidRequests, bidderRequest) {
const method = 'GET';
const dfpClientId = '1';
const sec = 'ROS';
let url;
- 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 buildRequests
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildRequests: function(bidRequests, bidderRequest) {
const method = 'GET';
const dfpClientId = '1';
const sec = 'ROS';
let url;
Function getSpaces
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function getSpaces(bidRequests, ml) {
let impType = bidRequests.reduce((previousBits, bid) => (bid.mediaTypes && bid.mediaTypes[VIDEO]) ? (bid.mediaTypes[VIDEO].context == 'outstream' ? (previousBits | 2) : (previousBits | 1)) : previousBits, 0);
// Only one type of auction is supported at a time
if (impType) {
bidRequests = bidRequests.filter((bid) => bid.mediaTypes && bid.mediaTypes[VIDEO] && (impType & VAST_INSTREAM ? (!bid.mediaTypes[VIDEO].context || bid.mediaTypes[VIDEO].context == 'instream') : (bid.mediaTypes[VIDEO].context == 'outstream')));
- 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 getViewabilityTracker
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getViewabilityTracker() {
let TIME_PARTITIONS = 5;
let VIEWABILITY_TIME = 1000;
let VIEWABILITY_MIN_RATIO = 0.5;
let publicApi;
Function waitForElementsPresent
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function waitForElementsPresent(elements) {
const observer = new MutationObserver(function (mutationList, observer) {
let index;
let adView;
if (mutationList && Array.isArray(mutationList)) {
Function interpretResponse
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
interpretResponse: function(serverResponse, request) {
const response = serverResponse.body;
let bidResponses = [];
if (response && !isEmpty(response.sp)) {
Function compareSizesByPriority
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function compareSizesByPriority(size1, size2) {
var priorityOrderForSizesAsc = isMobileDevice() ? PRIORITY_ORDER_FOR_MOBILE_SIZES_ASC : PRIORITY_ORDER_FOR_DESKTOP_SIZES_ASC;
var index1 = priorityOrderForSizesAsc.indexOf(size1);
var index2 = priorityOrderForSizesAsc.indexOf(size2);
if (index1 > -1) {
- 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 observer
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const observer = new MutationObserver(function (mutationList, observer) {
let index;
let adView;
if (mutationList && Array.isArray(mutationList)) {
mutationList.forEach(mr => {
Function getViewabilityTracker
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getViewabilityTracker() {
let TIME_PARTITIONS = 5;
let VIEWABILITY_TIME = 1000;
let VIEWABILITY_MIN_RATIO = 0.5;
let publicApi;
- 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 getSize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getSize(bid, first) {
var arraySizes = bid.sizes && bid.sizes.length ? getSizesSortedByPriority(bid.sizes) : [];
if (arraySizes.length) {
return first ? arraySizes[0] : arraySizes.join(',');
} else {
- 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 _mapAdUnitPathToElementId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function _mapAdUnitPathToElementId(adUnitCode) {
if (isGptPubadsDefined()) {
// eslint-disable-next-line no-undef
const adSlots = googletag.pubads().getSlots();
const isMatchingAdSlot = isSlotMatchingAdUnitCode(adUnitCode);
- 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"