modules/nativoBidAdapter.js
File nativoBidAdapter.js
has 493 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { deepAccess, isEmpty } from '../src/utils.js'
import { registerBidder } from '../src/adapters/bidderFactory.js'
import { BANNER } from '../src/mediaTypes.js'
import { getGlobal } from '../src/prebidGlobal.js'
import { ortbConverter } from '../libraries/ortbConverter/converter.js'
Function buildRequests
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buildRequests: function (validBidRequests, bidderRequest) {
// Get OpenRTB Data
const openRTBData = converter.toORTB({bidRequests: validBidRequests, bidderRequest})
const openRTBDataString = JSON.stringify(openRTBData)
Function getUserSyncs
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getUserSyncs: function (
syncOptions,
serverResponses,
gdprConsent,
uspConsent
Function interpretResponse
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
interpretResponse: function (response, request) {
// If the bid response was empty, return []
if (!response || !response.body || isEmpty(response.body)) return []
try {
Function parseFloorPriceData
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function parseFloorPriceData(bidRequest) {
if (typeof bidRequest.getFloor !== 'function') return
// Setup price floor data per bid request
let bidRequestFloorPriceData = {}
Function BidDataMap
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function BidDataMap() {
const referenceMap = {}
const bids = []
/**
Function buildRequests
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
buildRequests: function (validBidRequests, bidderRequest) {
// Get OpenRTB Data
const openRTBData = converter.toORTB({bidRequests: validBidRequests, bidderRequest})
const openRTBDataString = JSON.stringify(openRTBData)
- 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 BidDataMap
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
export function BidDataMap() {
const referenceMap = {}
const bids = []
/**
- 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"