prebid/Prebid.js

View on GitHub
modules/discoveryBidAdapter.js

Summary

Maintainability
F
1 wk
Test Coverage

File discoveryBidAdapter.js has 547 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utils from '../src/utils.js';
import { getStorageManager } from '../src/storageManager.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE } from '../src/mediaTypes.js';

Severity: Major
Found in modules/discoveryBidAdapter.js - About 1 day to fix

    Function interpretResponse has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

      interpretResponse: function (serverResponse, bidRequest) {
        const bids = getKv(serverResponse, 'body', 'seatbid', 0, 'bid');
        const cur = getKv(serverResponse, 'body', 'cur');
        const bidResponses = [];
        for (let bid of bids) {
    Severity: Minor
    Found in modules/discoveryBidAdapter.js - About 3 hrs to fix

    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 interpretResponse has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      interpretResponse: function (serverResponse, bidRequest) {
        const bids = getKv(serverResponse, 'body', 'seatbid', 0, 'bid');
        const cur = getKv(serverResponse, 'body', 'cur');
        const bidResponses = [];
        for (let bid of bids) {
    Severity: Major
    Found in modules/discoveryBidAdapter.js - About 3 hrs to fix

      Function getParam has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getParam(validBidRequests, bidderRequest) {
        const pubcid = utils.deepAccess(validBidRequests[0], 'crumbs.pubcid');
        const sharedid =
          utils.deepAccess(validBidRequests[0], 'userId.sharedid.id') ||
          utils.deepAccess(validBidRequests[0], 'userId.pubcid');
      Severity: Major
      Found in modules/discoveryBidAdapter.js - About 3 hrs to fix

        Consider simplifying this complex logical expression.
        Open

          if (items && items.length) {
            let c = {
              // TODO: fix auctionId leak: https://github.com/prebid/Prebid.js/issues/9781
              id: 'pp_hbjs_' + auctionId,
              test: +isTest,
        Severity: Critical
        Found in modules/discoveryBidAdapter.js - About 2 hrs to fix

          Function getItems has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getItems(validBidRequests, bidderRequest) {
            let items = [];
            items = validBidRequests.map((req, i) => {
              let ret = {};
              // eslint-disable-next-line no-debugger
          Severity: Minor
          Found in modules/discoveryBidAdapter.js - About 1 hr to fix

            Function getUserSyncs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              getUserSyncs: function (syncOptions, serverResponse, gdprConsent, uspConsent, gppConsent) {
                const origin = encodeURIComponent(location.origin || `https://${location.host}`);
                let syncParamUrl = `dm=${origin}`;
            
                if (gdprConsent && gdprConsent.consentString) {
            Severity: Minor
            Found in modules/discoveryBidAdapter.js - About 1 hr to fix

            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 getParam has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

            function getParam(validBidRequests, bidderRequest) {
              const pubcid = utils.deepAccess(validBidRequests[0], 'crumbs.pubcid');
              const sharedid =
                utils.deepAccess(validBidRequests[0], 'userId.sharedid.id') ||
                utils.deepAccess(validBidRequests[0], 'userId.pubcid');
            Severity: Minor
            Found in modules/discoveryBidAdapter.js - About 1 hr to fix

            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 getDevice has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getDevice() {
              let check = false;
              (function (a) {
                let reg1 = new RegExp(
                  [
            Severity: Minor
            Found in modules/discoveryBidAdapter.js - About 1 hr to fix

              Function getUserSyncs has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getUserSyncs: function (syncOptions, serverResponse, gdprConsent, uspConsent, gppConsent) {
                  const origin = encodeURIComponent(location.origin || `https://${location.host}`);
                  let syncParamUrl = `dm=${origin}`;
              
                  if (gdprConsent && gdprConsent.consentString) {
              Severity: Minor
              Found in modules/discoveryBidAdapter.js - About 1 hr to fix

                Function isBidRequestValid has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  isBidRequestValid: function (bid) {
                    if (bid.params.token) {
                      globals['token'] = bid.params.token;
                    }
                    if (bid.params.publisher) {
                Severity: Minor
                Found in modules/discoveryBidAdapter.js - About 55 mins to fix

                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 deeply nested control flow statements.
                Open

                            if (admObj.link.url) {
                              native.clickUrl = admObj.link.url;
                            }
                Severity: Major
                Found in modules/discoveryBidAdapter.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                switch (tracker.method) {
                                  case 1:
                                    native.impressionTrackers.push(tracker.url);
                                    break;
                                  // case 2:
                  Severity: Major
                  Found in modules/discoveryBidAdapter.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  if (tracker.event !== 1) {
                                    return;
                                  }
                    Severity: Major
                    Found in modules/discoveryBidAdapter.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    switch (asset.img.type) {
                                      case 1:
                                        native.icon = {
                                          url: asset.img.url,
                                          width: asset.img.w,
                      Severity: Major
                      Found in modules/discoveryBidAdapter.js - About 45 mins to fix

                        Function getUserSyncs has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          getUserSyncs: function (syncOptions, serverResponse, gdprConsent, uspConsent, gppConsent) {
                        Severity: Minor
                        Found in modules/discoveryBidAdapter.js - About 35 mins to fix

                          Function getPageTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function getPageTitle(win = window) {
                            try {
                              const ogTitle = win.top.document.querySelector('meta[property="og:title"]')
                              return win.top.document.title || (ogTitle && ogTitle.content) || '';
                            } catch (e) {
                          Severity: Minor
                          Found in modules/discoveryBidAdapter.js - About 35 mins to fix

                          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

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                            getUserSyncs: function (syncOptions, serverResponse, gdprConsent, uspConsent, gppConsent) {
                              const origin = encodeURIComponent(location.origin || `https://${location.host}`);
                              let syncParamUrl = `dm=${origin}`;
                          
                              if (gdprConsent && gdprConsent.consentString) {
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 day to fix
                          modules/mediagoBidAdapter.js on lines 555..592

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 347.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          function transformSizes(requestSizes) {
                            let sizes = [];
                            let sizeObj = {};
                          
                            if (
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 day to fix
                          modules/mediagoBidAdapter.js on lines 231..250

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 239.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          function getDevice() {
                            let check = false;
                            (function (a) {
                              let reg1 = new RegExp(
                                [
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 6 hrs to fix
                          modules/mediagoBidAdapter.js on lines 142..184

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 156.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                                      } else if (asset.data) {
                                        native.data = asset.data.value;
                                      } else if (asset.img) {
                                        switch (asset.img.type) {
                                          case 1:
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 4 hrs to fix
                          modules/adagioBidAdapter.js on lines 493..512

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 134.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          export function getPageTitle(win = window) {
                            try {
                              const ogTitle = win.top.document.querySelector('meta[property="og:title"]')
                              return win.top.document.title || (ogTitle && ogTitle.content) || '';
                            } catch (e) {
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 4 hrs to fix
                          modules/mediagoBidAdapter.js on lines 42..50

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 126.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          export function getPageDescription(win = window) {
                            let element;
                          
                            try {
                              element = win.top.document.querySelector('meta[name="description"]') ||
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 4 hrs to fix
                          modules/mediagoBidAdapter.js on lines 57..69

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 124.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          const popInAdSize = [
                            { w: 300, h: 250 },
                            { w: 300, h: 600 },
                            { w: 728, h: 90 },
                            { w: 970, h: 250 },
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 4 hrs to fix
                          modules/mediagoBidAdapter.js on lines 253..263

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 120.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                          function getBidFloor(bid) {
                            if (!utils.isFn(bid.getFloor)) {
                              return utils.deepAccess(bid, 'params.bidfloor', 0);
                            }
                          
                          
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 2 hrs to fix
                          modules/mediagoBidAdapter.js on lines 208..223

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 93.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          export function getPageKeywords(win = window) {
                            let element;
                          
                            try {
                              element = win.top.document.querySelector('meta[name="keywords"]');
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 2 hrs to fix
                          modules/mediagoBidAdapter.js on lines 75..85

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 92.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                          function getReferrer(bidRequest = {}, bidderRequest = {}) {
                            let pageUrl;
                            if (bidRequest.params && bidRequest.params.referrer) {
                              pageUrl = bidRequest.params.referrer;
                            } else {
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 2 hrs to fix
                          modules/mediagoBidAdapter.js on lines 348..356

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 90.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          export function getConnectionDownLink(win = window) {
                            const nav = win.navigator || {};
                            return nav && nav.connection && nav.connection.downlink >= 0 ? nav.connection.downlink.toString() : undefined;
                          }
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 2 hrs to fix
                          modules/mediagoBidAdapter.js on lines 91..94

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 84.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                                  page: {
                                    title: title ? title.slice(0, 100) : undefined,
                                    desc: desc ? desc.slice(0, 300) : undefined,
                                    keywords: keywords ? keywords.slice(0, 100) : undefined,
                                    hLen: topWindow.history?.length || undefined,
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 2 hrs to fix
                          modules/mediagoBidAdapter.js on lines 435..440

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 83.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                                if (!matchSize) {
                                  matchSize = sizes[0]
                                    ? { h: sizes[0].height || 0, w: sizes[0].width || 0 }
                                    : { h: 0, w: 0 };
                                }
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 hr to fix
                          modules/mediagoBidAdapter.js on lines 287..289

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 72.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                                for (let size of sizes) {
                                  matchSize = popInAdSize.find(
                                    (item) => size.width === item.w && size.height === item.h
                                  );
                                  if (matchSize) {
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 hr to fix
                          modules/mediagoBidAdapter.js on lines 281..286

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 59.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              if (bid.params.badv) {
                                globals['badv'] = Array.isArray(bid.params.badv) ? bid.params.badv : [];
                              }
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 hr to fix
                          modules/discoveryBidAdapter.js on lines 548..550

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 57.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                          export function getCurrentTimeToUTCString() {
                            const date = new Date();
                            date.setTime(date.getTime() + COOKIE_RETENTION_TIME);
                            return date.toUTCString();
                          }
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 hr to fix
                          modules/mediagoBidAdapter.js on lines 362..366

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 57.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Similar blocks of code found in 2 locations. Consider refactoring.
                          Open

                              if (bid.params.bcat) {
                                globals['bcat'] = Array.isArray(bid.params.bcat) ? bid.params.bcat : [];
                              }
                          Severity: Major
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 hr to fix
                          modules/discoveryBidAdapter.js on lines 551..553

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 57.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          Identical blocks of code found in 2 locations. Consider refactoring.
                          Open

                                  device: {
                                    nbw: getConnectionDownLink(),
                                    hc: topWindow.navigator?.hardwareConcurrency || undefined,
                                    dm: topWindow.navigator?.deviceMemory || undefined,
                                  }
                          Severity: Minor
                          Found in modules/discoveryBidAdapter.js and 1 other location - About 40 mins to fix
                          modules/mediagoBidAdapter.js on lines 441..445

                          Duplicated Code

                          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                          Tuning

                          This issue has a mass of 48.

                          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                          Refactorings

                          Further Reading

                          There are no issues that match your filters.

                          Category
                          Status