prebid/Prebid.js

View on GitHub
modules/mgidBidAdapter.js

Summary

Maintainability
F
2 wks
Test Coverage

Function createNativeRequest has a Cognitive Complexity of 105 (exceeds 5 allowed). Consider refactoring.
Open

function createNativeRequest(params) {
  let nativeRequestObject = {
    plcmtcnt: 1,
    assets: []
  };
Severity: Minor
Found in modules/mgidBidAdapter.js - About 2 days 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

File mgidBidAdapter.js has 710 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  _each,
  deepAccess,
  isPlainObject,
  isArray,
Severity: Major
Found in modules/mgidBidAdapter.js - About 1 day to fix

    Function buildRequests has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

      buildRequests: (validBidRequests, bidderRequest) => {
        // convert Native ORTB definition to old-style prebid native definition
        validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
        const [bidRequest] = validBidRequests;
        logInfo(LOG_INFO_PREFIX + `buildRequests`);
    Severity: Minor
    Found in modules/mgidBidAdapter.js - About 7 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

    Consider simplifying this complex logical expression.
    Open

          if (!(nativeRequestObject.assets && nativeRequestObject.assets.length > 0 && nativeRequestObject.assets.hasOwnProperty(key))) {
            switch (key) {
              case NATIVE_ASSETS.TITLE.KEY:
                assetObj = {
                  id: NATIVE_ASSETS.TITLE.ID,
    Severity: Critical
    Found in modules/mgidBidAdapter.js - About 6 hrs to fix

      Function buildRequests has 158 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        buildRequests: (validBidRequests, bidderRequest) => {
          // convert Native ORTB definition to old-style prebid native definition
          validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
          const [bidRequest] = validBidRequests;
          logInfo(LOG_INFO_PREFIX + `buildRequests`);
      Severity: Major
      Found in modules/mgidBidAdapter.js - About 6 hrs to fix

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

          getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) => {
            logInfo(LOG_INFO_PREFIX + `getUserSyncs`);
            const spb = isPlainObject(config.getConfig('userSync')) &&
                isNumber(config.getConfig('userSync').syncsPerBidder)
              ? config.getConfig('userSync').syncsPerBidder : USERSYNC_DEFAULT_CONFIG.syncsPerBidder;
        Severity: Minor
        Found in modules/mgidBidAdapter.js - About 5 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

        Consider simplifying this complex logical expression.
        Open

            if (adm && adm.native && adm.native.assets && adm.native.assets.length > 0) {
              newBid.mediaType = NATIVE;
              for (let i = 0, len = adm.native.assets.length; i < len; i++) {
                switch (adm.native.assets[i].id) {
                  case NATIVE_ASSETS.TITLE.ID:
        Severity: Critical
        Found in modules/mgidBidAdapter.js - About 4 hrs to fix

          Function createNativeRequest has 104 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createNativeRequest(params) {
            let nativeRequestObject = {
              plcmtcnt: 1,
              assets: []
            };
          Severity: Major
          Found in modules/mgidBidAdapter.js - About 4 hrs to fix

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

              isBidRequestValid: (bid) => {
                const banner = deepAccess(bid, 'mediaTypes.banner');
                const native = deepAccess(bid, 'mediaTypes.native');
                let nativeOk = isPlainObject(native);
                if (nativeOk) {
            Severity: Minor
            Found in modules/mgidBidAdapter.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 getUserSyncs has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              getUserSyncs: (syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) => {
                logInfo(LOG_INFO_PREFIX + `getUserSyncs`);
                const spb = isPlainObject(config.getConfig('userSync')) &&
                    isNumber(config.getConfig('userSync').syncsPerBidder)
                  ? config.getConfig('userSync').syncsPerBidder : USERSYNC_DEFAULT_CONFIG.syncsPerBidder;
            Severity: Major
            Found in modules/mgidBidAdapter.js - About 2 hrs to fix

              Function parseNativeResponse has 50 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function parseNativeResponse(bid, newBid) {
                newBid.native = {};
                if (bid.hasOwnProperty('adm')) {
                  let adm = '';
                  try {
              Severity: Minor
              Found in modules/mgidBidAdapter.js - About 2 hrs to fix

                Function parseNativeResponse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                function parseNativeResponse(bid, newBid) {
                  newBid.native = {};
                  if (bid.hasOwnProperty('adm')) {
                    let adm = '';
                    try {
                Severity: Minor
                Found in modules/mgidBidAdapter.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 isBidRequestValid has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  isBidRequestValid: (bid) => {
                    const banner = deepAccess(bid, 'mediaTypes.banner');
                    const native = deepAccess(bid, 'mediaTypes.native');
                    let nativeOk = isPlainObject(native);
                    if (nativeOk) {
                Severity: Minor
                Found in modules/mgidBidAdapter.js - About 1 hr to fix

                  Function getBidFloor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  function getBidFloor(bid, cur) {
                    let bidFloor = getBidIdParameter('bidfloor', bid.params) || getBidIdParameter('bidFloor', bid.params) || 0;
                    const reqCur = cur
                  
                    if (!bidFloor && isFn(bid.getFloor)) {
                  Severity: Minor
                  Found in modules/mgidBidAdapter.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 prebidBid has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function prebidBid(serverBid, cur) {
                    if (!isStr(cur) || cur === '') {
                      cur = DEFAULT_CUR;
                    }
                    const bid = {
                  Severity: Minor
                  Found in modules/mgidBidAdapter.js - About 1 hr to fix

                    Function createBannerRequest has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function createBannerRequest(bid) {
                      const sizes = deepAccess(bid, 'mediaTypes.banner.sizes');
                      let format = [];
                      if (sizes.length > 1) {
                        for (let f = 0; f < sizes.length; f++) {
                    Severity: Minor
                    Found in modules/mgidBidAdapter.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

                    Consider simplifying this complex logical expression.
                    Open

                          if (serverResponses &&
                            isArray(serverResponses) &&
                            serverResponses.length > 0 &&
                            isPlainObject(serverResponses[0].body) &&
                            isPlainObject(serverResponses[0].body.ext) &&
                    Severity: Major
                    Found in modules/mgidBidAdapter.js - About 1 hr to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (hmin > 0) {
                                    assetObj.img.hmin = hmin;
                                  }
                      Severity: Major
                      Found in modules/mgidBidAdapter.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if (!assetObj.img.h) {
                                      assetObj.img.h = DEFAULT_ICON_HEIGHT;
                                    }
                        Severity: Major
                        Found in modules/mgidBidAdapter.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                      if (params[key].required) {
                                        isInvalidNativeRequest = true;
                                        return;
                                      }
                          Severity: Major
                          Found in modules/mgidBidAdapter.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        if (!assetObj.img.w) {
                                          assetObj.img.w = DEFAULT_IMAGE_WIDTH;
                                        }
                            Severity: Major
                            Found in modules/mgidBidAdapter.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                          if (!assetObj.img.h) {
                                            assetObj.img.h = DEFAULT_IMAGE_HEIGHT;
                                          }
                              Severity: Major
                              Found in modules/mgidBidAdapter.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                            if (!assetObj.img.w) {
                                              assetObj.img.w = DEFAULT_ICON_WIDTH;
                                            }
                                Severity: Major
                                Found in modules/mgidBidAdapter.js - About 45 mins to fix

                                  Function extractDomainFromHost has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function extractDomainFromHost(pageHost) {
                                    if (pageHost === 'localhost') {
                                      return 'localhost'
                                    }
                                    let domain = null;
                                  Severity: Minor
                                  Found in modules/mgidBidAdapter.js - About 45 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 (wmin > 0) {
                                                assetObj.img.wmin = wmin;
                                              }
                                  Severity: Major
                                  Found in modules/mgidBidAdapter.js - About 45 mins to fix

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

                                      onBidWon: (bid) => {
                                        const cpm = deepAccess(bid, 'adserverTargeting.hb_pb') || '';
                                        if (isStr(bid.nurl) && bid.nurl !== '') {
                                          bid.nurl = bid.nurl.replace(
                                            /\${AUCTION_PRICE}/,
                                    Severity: Minor
                                    Found in modules/mgidBidAdapter.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

                                    Function pageInfo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function pageInfo() {
                                      var w, d, l, r, m, p, t;
                                      for (w = window, d = w.document, l = d.location.href, r = d.referrer, m = 0, t = new Date(); w !== w.parent;) {
                                        try {
                                          p = w.parent; l = p.location.href; r = p.document.referrer; w = p;
                                    Severity: Minor
                                    Found in modules/mgidBidAdapter.js - About 25 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

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

                                              case NATIVE_ASSETS.ICON.ID:
                                                newBid.native.icon = {
                                                  url: adm.native.assets[i].img && adm.native.assets[i].img.url,
                                                  height: adm.native.assets[i].img && adm.native.assets[i].img.h,
                                                  width: adm.native.assets[i].img && adm.native.assets[i].img.w,
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 6 hrs to fix
                                    modules/adtrueBidAdapter.js on lines 231..237
                                    modules/adtrueBidAdapter.js on lines 238..244
                                    modules/mgidBidAdapter.js on lines 699..705

                                    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 164.

                                    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 4 locations. Consider refactoring.
                                    Open

                                              case NATIVE_ASSETS.IMAGE.ID:
                                                newBid.native.image = {
                                                  url: adm.native.assets[i].img && adm.native.assets[i].img.url,
                                                  height: adm.native.assets[i].img && adm.native.assets[i].img.h,
                                                  width: adm.native.assets[i].img && adm.native.assets[i].img.w,
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 6 hrs to fix
                                    modules/adtrueBidAdapter.js on lines 231..237
                                    modules/adtrueBidAdapter.js on lines 238..244
                                    modules/mgidBidAdapter.js on lines 706..712

                                    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 164.

                                    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 (serverResponses &&
                                            isArray(serverResponses) &&
                                            serverResponses.length > 0 &&
                                            isPlainObject(serverResponses[0].body) &&
                                            isPlainObject(serverResponses[0].body.ext) &&
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 5 hrs to fix
                                    modules/mgidXBidAdapter.js on lines 221..229

                                    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 138.

                                    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

                                      try {
                                        let domains = /[-\w]+\.([-\w]+|[-\w]{3,}|[-\w]{1,3}\.[-\w]{2})$/i.exec(pageHost);
                                        if (domains != null && domains.length > 0) {
                                          domain = domains[0];
                                          for (let i = 1; i < domains.length; i++) {
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 4 hrs to fix
                                    modules/undertoneBidAdapter.js on lines 31..43

                                    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 131.

                                    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 (pixels.length === 0) {
                                              for (let i = 0; i < spb; i++) {
                                                syncs.push({
                                                  type: 'image',
                                                  url: 'https://cm.mgid.com/i.gif?' + q.replace('{cbuster}', Math.round(new Date().getTime())) // randomly selects partner if sync required
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 4 hrs to fix
                                    modules/mgidXBidAdapter.js on lines 256..270

                                    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 122.

                                    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 commonNativeRequestObject(nativeAsset, params) {
                                      const key = nativeAsset.KEY;
                                      return {
                                        id: nativeAsset.ID,
                                        required: params[key].required ? 1 : 0,
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 2 hrs to fix
                                    modules/pubwiseBidAdapter.js on lines 648..659

                                    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 94.

                                    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 wmin = params[key].wmin || params[key].minimumWidth || (isArray(params[key].minsizes) && params[key].minsizes.length > 0 ? params[key].minsizes[0] : 0);
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 2 hrs to fix
                                    modules/mgidBidAdapter.js on lines 580..580

                                    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 81.

                                    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 hmin = params[key].hmin || params[key].minimumHeight || (isArray(params[key].minsizes) && params[key].minsizes.length > 1 ? params[key].minsizes[1] : 0);
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 2 hrs to fix
                                    modules/mgidBidAdapter.js on lines 579..579

                                    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 81.

                                    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 4 locations. Consider refactoring.
                                    Open

                                                    h: params[key].h || params[key].height || (isArray(params[key].sizes) && params[key].sizes.length > 1 ? params[key].sizes[1] : 0),
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 2 hrs to fix
                                    modules/mgidBidAdapter.js on lines 586..586
                                    modules/mgidBidAdapter.js on lines 611..611
                                    modules/mgidBidAdapter.js on lines 612..612

                                    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 79.

                                    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 4 locations. Consider refactoring.
                                    Open

                                                    w: params[key].w || params[key].width || (isArray(params[key].sizes) && params[key].sizes.length > 0 ? params[key].sizes[0] : 0),
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 2 hrs to fix
                                    modules/mgidBidAdapter.js on lines 587..587
                                    modules/mgidBidAdapter.js on lines 611..611
                                    modules/mgidBidAdapter.js on lines 612..612

                                    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 79.

                                    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 4 locations. Consider refactoring.
                                    Open

                                                    w: params[key].w || params[key].width || (isArray(params[key].sizes) && params[key].sizes.length > 0 ? params[key].sizes[0] : 0),
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 2 hrs to fix
                                    modules/mgidBidAdapter.js on lines 586..586
                                    modules/mgidBidAdapter.js on lines 587..587
                                    modules/mgidBidAdapter.js on lines 612..612

                                    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 79.

                                    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 4 locations. Consider refactoring.
                                    Open

                                                    h: params[key].h || params[key].height || (isArray(params[key].sizes) && params[key].sizes.length > 0 ? params[key].sizes[1] : 0),
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 2 hrs to fix
                                    modules/mgidBidAdapter.js on lines 586..586
                                    modules/mgidBidAdapter.js on lines 587..587
                                    modules/mgidBidAdapter.js on lines 611..611

                                    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 79.

                                    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

                                    const NATIVE_MINIMUM_REQUIRED_IMAGE_ASSETS = [
                                      {
                                        id: NATIVE_ASSETS.SPONSOREDBY.ID,
                                        required: true,
                                        data: {
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 2 hrs to fix
                                    modules/pubwiseBidAdapter.js on lines 106..122

                                    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 78.

                                    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

                                              case NATIVE_ASSETS.TITLE.ID:
                                                newBid.native.title = adm.native.assets[i].title && adm.native.assets[i].title.text;
                                                break;
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 1 hr to fix
                                    modules/adtrueBidAdapter.js on lines 228..230

                                    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 68.

                                    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

                                        const spb = isPlainObject(config.getConfig('userSync')) &&
                                            isNumber(config.getConfig('userSync').syncsPerBidder)
                                          ? config.getConfig('userSync').syncsPerBidder : USERSYNC_DEFAULT_CONFIG.syncsPerBidder;
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 1 hr to fix
                                    modules/mgidXBidAdapter.js on lines 215..217

                                    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 61.

                                    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 (isPlainObject(gdprConsent) && typeof gdprConsent?.gdprApplies === 'boolean' && gdprConsent.gdprApplies) {
                                            query.push('gdpr=1');
                                          } else {
                                            query.push('gdpr=0');
                                          }
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 1 hr to fix
                                    modules/mgidXBidAdapter.js on lines 235..239

                                    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 4 locations. Consider refactoring.
                                    Open

                                          if (isPlainObject(gppConsent) && gppConsent?.gppString) {
                                            query.push(`gppString=${encodeURIComponent(gppConsent?.gppString)}`);
                                          }
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 35 mins to fix
                                    modules/mgidBidAdapter.js on lines 395..397
                                    modules/mgidXBidAdapter.js on lines 240..242
                                    modules/mgidXBidAdapter.js on lines 243..245

                                    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 47.

                                    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 4 locations. Consider refactoring.
                                    Open

                                          if (isPlainObject(uspConsent) && uspConsent?.consentString) {
                                            query.push(`us_privacy=${encodeURIComponent(uspConsent?.consentString)}`);
                                          }
                                    Severity: Major
                                    Found in modules/mgidBidAdapter.js and 3 other locations - About 35 mins to fix
                                    modules/mgidBidAdapter.js on lines 398..400
                                    modules/mgidXBidAdapter.js on lines 240..242
                                    modules/mgidXBidAdapter.js on lines 243..245

                                    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 47.

                                    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

                                          query.push('gdpr_consent=' + encodeURIComponent(isPlainObject(gdprConsent) && isStr(gdprConsent?.consentString) ? gdprConsent.consentString : ''));
                                    Severity: Minor
                                    Found in modules/mgidBidAdapter.js and 1 other location - About 30 mins to fix
                                    modules/mgidXBidAdapter.js on lines 234..234

                                    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 45.

                                    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