File sonobiBidAdapter.js
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { parseSizesInput, logError, generateUUID, isEmpty, deepAccess, logWarn, logMessage, isFn, isPlainObject } from '../src/utils.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { config } from '../src/config.js';
import { Renderer } from '../src/Renderer.js';
Function buildRequests
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
buildRequests: (validBidRequests, bidderRequest) => {
const bids = validBidRequests.map(bid => {
let slotIdentifier = _validateSlot(bid);
if (/^[\/]?[\d]+[[\/].+[\/]?]?$/.test(slotIdentifier)) {
slotIdentifier = slotIdentifier.charAt(0) === '/' ? slotIdentifier : '/' + slotIdentifier;
- 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 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
buildRequests: (validBidRequests, bidderRequest) => {
const bids = validBidRequests.map(bid => {
let slotIdentifier = _validateSlot(bid);
if (/^[\/]?[\d]+[[\/].+[\/]?]?$/.test(slotIdentifier)) {
slotIdentifier = slotIdentifier.charAt(0) === '/' ? slotIdentifier : '/' + slotIdentifier;
Function interpretResponse
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
interpretResponse: (serverResponse, bidderRequest) => {
const bidResponse = serverResponse.body;
const bidsReturned = [];
const referrer = bidderRequest.data.ref;
if (Object.keys(bidResponse.slots).length === 0) {
Function loadOrCreateFirstPartyData
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loadOrCreateFirstPartyData() {
var FIRST_PARTY_KEY = '_iiq_fdata';
var tryParse = function (data) {
try {
return JSON.parse(data);
Function isBidRequestValid
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
isBidRequestValid: (bid) => {
if (!bid.params) {
return false;
}
if (!bid.params.ad_unit && !bid.params.placement_id) {
- 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 loadOrCreateFirstPartyData
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function loadOrCreateFirstPartyData() {
var FIRST_PARTY_KEY = '_iiq_fdata';
var tryParse = function (data) {
try {
return JSON.parse(data);
- 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 _validateMediaType
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function _validateMediaType(bidRequest) {
let mediaType;
if (deepAccess(bidRequest, 'mediaTypes.video')) {
mediaType = 'video';
} else if (deepAccess(bidRequest, 'mediaTypes.banner')) {
- 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
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;