modules/undertoneBidAdapter.js
Function buildRequests
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buildRequests: function(validBidRequests, bidderRequest) {
const vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
const pageSizeArray = vw == 0 || vh == 0 ? null : [vw, vh];
const commons = {
Consider simplifying this complex logical expression. Open
Open
if (videoMediaType) {
bid.video = {
playerSize: deepAccess(bidReq, 'mediaTypes.video.playerSize') || null,
streamType: deepAccess(bidReq, 'mediaTypes.video.context') || null,
playbackMethod: deepAccess(bidReq, 'params.video.playbackMethod') || null,
Function getUserSyncs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getUserSyncs: function(syncOptions, serverResponses, gdprConsent, usPrivacy) {
const syncs = [];
let gdprParams = getGdprQueryParams(gdprConsent);
let iframePrivacyParams = '';
Function interpretResponse
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
interpretResponse: function(serverResponse, request) {
const bids = [];
const body = serverResponse.body;
if (body && Array.isArray(body) && body.length > 0) {
Function buildRequests
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
buildRequests: function(validBidRequests, bidderRequest) {
const vw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
const vh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
const pageSizeArray = vw == 0 || vh == 0 ? null : [vw, vh];
const commons = {
- 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 getUserSyncs
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
getUserSyncs: function(syncOptions, serverResponses, gdprConsent, usPrivacy) {
const syncs = [];
let gdprParams = getGdprQueryParams(gdprConsent);
let iframePrivacyParams = '';
- 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"