File adapterManager.js
has 588 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** @module adaptermanger */
import {
deepAccess,
deepClone,
Function makeBidRequests
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}, auctionMetrics) {
auctionMetrics = useMetrics(auctionMetrics);
/**
* emit and pass adunits for external modification
* @see {@link https://github.com/prebid/Prebid.js/issues/4149|Issue}
Function callBids
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, requestCallbacks, requestBidsTimeout, onTimelyResponse, ortb2Fragments = {}) => {
if (!bidRequests.length) {
logWarn('callBids executed with no bidRequests. Were they filtered by labels or sizing?');
return;
}
Function aliasBidAdapter
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
adapterManager.aliasBidAdapter = function (bidderCode, alias, options) {
let existingAlias = _bidderRegistry[alias];
if (typeof existingAlias === 'undefined') {
let bidAdapter = _bidderRegistry[bidderCode];
- 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 aliasBidAdapter
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
adapterManager.aliasBidAdapter = function (bidderCode, alias, options) {
let existingAlias = _bidderRegistry[alias];
if (typeof existingAlias === 'undefined') {
let bidAdapter = _bidderRegistry[bidderCode];
Function registerBidAdapter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
adapterManager.registerBidAdapter = function (bidAdapter, bidderCode, {supportedMediaTypes = []} = {}) {
if (bidAdapter && bidderCode) {
if (typeof bidAdapter.callBids === 'function') {
_bidderRegistry[bidderCode] = bidAdapter;
GDPR_GVLIDS.register(MODULE_TYPE_BIDDER, bidderCode, bidAdapter.getSpec?.().gvlid);
- 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 makeBidRequests
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}, auctionMetrics) {
Function invokeBidderMethod
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function invokeBidderMethod(bidder, method, spec, fn, ...params) {
Function registerAnalyticsAdapter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
adapterManager.registerAnalyticsAdapter = function ({adapter, code, gvlid}) {
if (adapter && code) {
if (typeof adapter.enableAnalytics === 'function') {
adapter.code = code;
_analyticsRegistry[code] = { adapter, gvlid };
- 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 makeBidRequests
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}, auctionMetrics) {
auctionMetrics = useMetrics(auctionMetrics);
/**
* emit and pass adunits for external modification
* @see {@link https://github.com/prebid/Prebid.js/issues/4149|Issue}
- 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"