prebid/Prebid.js

View on GitHub
modules/criteoBidAdapter.js

Summary

Maintainability
F
1 wk
Test Coverage

File criteoBidAdapter.js has 735 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { deepAccess, generateUUID, isArray, logError, logInfo, logWarn, parseUrl } from '../src/utils.js';
import { loadExternalScript } from '../src/adloader.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
Severity: Major
Found in modules/criteoBidAdapter.js - About 1 day to fix

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

      getUserSyncs: function (syncOptions, _, gdprConsent, uspConsent, gppConsent = {}) {
        let { gppString = '', applicableSections = [] } = gppConsent;
    
        if (syncOptions.iframeEnabled && hasPurpose1Consent(gdprConsent)) {
          const fastBidVersion = config.getConfig('criteo.fastBidVersion');
    Severity: Minor
    Found in modules/criteoBidAdapter.js - About 1 day 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 buildCdbRequest has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

    function buildCdbRequest(context, bidRequests, bidderRequest) {
      let networkId;
      let pubid;
      let schain;
      let userIdAsEids;
    Severity: Minor
    Found in modules/criteoBidAdapter.js - About 1 day 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 buildCdbRequest has 156 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function buildCdbRequest(context, bidRequests, bidderRequest) {
      let networkId;
      let pubid;
      let schain;
      let userIdAsEids;
    Severity: Major
    Found in modules/criteoBidAdapter.js - About 6 hrs to fix

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

        getUserSyncs: function (syncOptions, _, gdprConsent, uspConsent, gppConsent = {}) {
          let { gppString = '', applicableSections = [] } = gppConsent;
      
          if (syncOptions.iframeEnabled && hasPurpose1Consent(gdprConsent)) {
            const fastBidVersion = config.getConfig('criteo.fastBidVersion');
      Severity: Major
      Found in modules/criteoBidAdapter.js - About 3 hrs to fix

        Function slots has 85 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            slots: bidRequests.map(bidRequest => {
              if (!userIdAsEids) {
                userIdAsEids = bidRequest.userIdAsEids;
              }
              networkId = bidRequest.params.networkId || networkId;
        Severity: Major
        Found in modules/criteoBidAdapter.js - About 3 hrs to fix

          Function interpretResponse has 78 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            interpretResponse: (response, request) => {
              const body = response.body || response;
          
              if (publisherTagAvailable()) {
                // eslint-disable-next-line no-undef
          Severity: Major
          Found in modules/criteoBidAdapter.js - About 3 hrs to fix

            Function getAssociatedBidRequest has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            function getAssociatedBidRequest(bidRequests, slot) {
              for (const request of bidRequests) {
                if (request.adUnitCode === slot.impid) {
                  if (request.params.zoneId && parseInt(request.params.zoneId) === slot.zoneid) {
                    return request;
            Severity: Minor
            Found in modules/criteoBidAdapter.js - About 2 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 enrichSlotWithFloors has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

            function enrichSlotWithFloors(slot, bidRequest) {
              try {
                const slotFloors = {};
            
                const getFloor = pickAvailableGetFloorFunc(bidRequest);
            Severity: Minor
            Found in modules/criteoBidAdapter.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 buildRequests has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              buildRequests: (bidRequests, bidderRequest) => {
                let url;
                let data;
                let fpd = bidderRequest.ortb2 || {};
            
            
            Severity: Minor
            Found in modules/criteoBidAdapter.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if (paramsVideo !== undefined) {
                        video.skip = video.skip || paramsVideo.skip || 0;
                        video.placement = video.placement || paramsVideo.placement;
                        video.minduration = video.minduration || paramsVideo.minduration;
                        video.playbackmethod = video.playbackmethod || paramsVideo.playbackmethod;
              Severity: Critical
              Found in modules/criteoBidAdapter.js - About 1 hr to fix

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

                function checkNativeSendId(bidRequest) {
                  return !(bidRequest.nativeParams &&
                    (
                      (bidRequest.nativeParams.image && ((bidRequest.nativeParams.image.sendId !== true || bidRequest.nativeParams.image.sendTargetingKeys === true))) ||
                      (bidRequest.nativeParams.icon && ((bidRequest.nativeParams.icon.sendId !== true || bidRequest.nativeParams.icon.sendTargetingKeys === true))) ||
                Severity: Minor
                Found in modules/criteoBidAdapter.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 enrichSlotWithFloors has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function enrichSlotWithFloors(slot, bidRequest) {
                  try {
                    const slotFloors = {};
                
                    const getFloor = pickAvailableGetFloorFunc(bidRequest);
                Severity: Minor
                Found in modules/criteoBidAdapter.js - About 1 hr to fix

                  Function buildCdbUrl has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function buildCdbUrl(context) {
                    let url = CDB_ENDPOINT;
                    url += '?profileId=' + PROFILE_ID_INLINE;
                    url += '&av=' + String(ADAPTER_VERSION);
                    url += '&wv=' + encodeURIComponent('$prebid.version$');
                  Severity: Minor
                  Found in modules/criteoBidAdapter.js - About 1 hr to fix

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

                    export function tryGetCriteoFastBid() {
                      // begin ref#1
                      try {
                        const fastBidStorageKey = 'criteo_fast_bid';
                        const hashPrefix = '// Hash: ';
                    Severity: Minor
                    Found in modules/criteoBidAdapter.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 (context === OUTSTREAM) {
                                  bid.renderer = createOutstreamVideoRenderer(slot);
                                }
                    Severity: Major
                    Found in modules/criteoBidAdapter.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                              if (request.mediaTypes?.video) {
                                return request;
                              }
                      Severity: Major
                      Found in modules/criteoBidAdapter.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                              } else if (request.mediaTypes?.banner || request.sizes) {
                                return request;
                              }
                        Severity: Major
                        Found in modules/criteoBidAdapter.js - About 45 mins to fix

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

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

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

                              interpretResponse: (response, request) => {
                                const body = response.body || response;
                            
                                if (publisherTagAvailable()) {
                                  // eslint-disable-next-line no-undef
                            Severity: Minor
                            Found in modules/criteoBidAdapter.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 buildCdbUrl has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function buildCdbUrl(context) {
                              let url = CDB_ENDPOINT;
                              url += '?profileId=' + PROFILE_ID_INLINE;
                              url += '&av=' + String(ADAPTER_VERSION);
                              url += '&wv=' + encodeURIComponent('$prebid.version$');
                            Severity: Minor
                            Found in modules/criteoBidAdapter.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

                            Avoid too many return statements within this function.
                            Open

                              return undefined;
                            Severity: Major
                            Found in modules/criteoBidAdapter.js - About 30 mins to fix

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

                                buildRequests: (bidRequests, bidderRequest) => {
                                  let url;
                                  let data;
                                  let fpd = bidderRequest.ortb2 || {};
                              
                              
                              Severity: Minor
                              Found in modules/criteoBidAdapter.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

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

                                isBidRequestValid: (bid) => {
                                  // either one of zoneId or networkId should be set
                                  if (!(bid && bid.params && (bid.params.zoneId || bid.params.networkId))) {
                                    return false;
                                  }
                              Severity: Minor
                              Found in modules/criteoBidAdapter.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 2 locations. Consider refactoring.
                              Open

                                    if (bidRequest.mediaTypes?.banner) {
                                      slotFloors.banner = {};
                                      const bannerSizes = parseSizes(deepAccess(bidRequest, 'mediaTypes.banner.sizes'))
                                      bannerSizes.forEach(bannerSize => slotFloors.banner[parseSize(bannerSize).toString()] = getFloor.call(bidRequest, { size: bannerSize, mediaType: BANNER }));
                                    }
                              Severity: Major
                              Found in modules/criteoBidAdapter.js and 1 other location - About 3 hrs to fix
                              modules/criteoBidAdapter.js on lines 801..805

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

                              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 (bidRequest.mediaTypes?.video) {
                                      slotFloors.video = {};
                                      const videoSizes = parseSizes(deepAccess(bidRequest, 'mediaTypes.video.playerSize'))
                                      videoSizes.forEach(videoSize => slotFloors.video[parseSize(videoSize).toString()] = getFloor.call(bidRequest, { size: videoSize, mediaType: VIDEO }));
                                    }
                              Severity: Major
                              Found in modules/criteoBidAdapter.js and 1 other location - About 3 hrs to fix
                              modules/criteoBidAdapter.js on lines 795..799

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

                              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 parseSizes(sizes, parser = s => s) {
                                if (sizes == undefined) {
                                  return [];
                                }
                                if (Array.isArray(sizes[0])) { // is there several sizes ? (ie. [[728,90],[200,300]])
                              Severity: Major
                              Found in modules/criteoBidAdapter.js and 1 other location - About 2 hrs to fix
                              modules/admaticBidAdapter.js on lines 355..363

                              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

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

                                    if (bidRequest.nativeOrtbRequest?.assets) {
                                      slot.ext = Object.assign({}, slot.ext, { assets: bidRequest.nativeOrtbRequest.assets });
                                    }
                              Severity: Major
                              Found in modules/criteoBidAdapter.js and 1 other location - About 1 hr to fix
                              modules/criteoBidAdapter.js on lines 292..294

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

                              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 (slot.ext?.dsa) {
                                          bid.meta = Object.assign({}, bid.meta, { dsa: slot.ext.dsa })
                                        }
                              Severity: Major
                              Found in modules/criteoBidAdapter.js and 1 other location - About 1 hr to fix
                              modules/criteoBidAdapter.js on lines 549..551

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

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

                                    (bidRequest.nativeParams.image && ((bidRequest.nativeParams.image.sendId !== true || bidRequest.nativeParams.image.sendTargetingKeys === true))) ||
                                    (bidRequest.nativeParams.icon && ((bidRequest.nativeParams.icon.sendId !== true || bidRequest.nativeParams.icon.sendTargetingKeys === true))) ||
                              Severity: Major
                              Found in modules/criteoBidAdapter.js and 4 other locations - About 45 mins to fix
                              modules/criteoBidAdapter.js on lines 493..495
                              modules/criteoBidAdapter.js on lines 493..496
                              modules/criteoBidAdapter.js on lines 493..497
                              modules/criteoBidAdapter.js on lines 493..498

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

                              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 (typeof bidderRequest.gdprConsent.gdprApplies !== 'undefined') {
                                    request.gdprConsent.gdprApplies = !!(bidderRequest.gdprConsent.gdprApplies);
                                  }
                              Severity: Minor
                              Found in modules/criteoBidAdapter.js and 1 other location - About 40 mins to fix
                              modules/underdogmediaBidAdapter.js on lines 127..129

                              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

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

                                  if (publisherTagAvailable()) {
                                    // eslint-disable-next-line no-undef
                                    const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(bid.auctionId);
                                    adapter.handleSetTargeting(bid);
                                  }
                              Severity: Minor
                              Found in modules/criteoBidAdapter.js and 1 other location - About 40 mins to fix
                              modules/criteoBidAdapter.js on lines 358..362

                              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

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

                                  if (publisherTagAvailable() && bid) {
                                    // eslint-disable-next-line no-undef
                                    const adapter = Criteo.PubTag.Adapters.Prebid.GetAdapter(bid.auctionId);
                                    adapter.handleBidWon(bid);
                                  }
                              Severity: Minor
                              Found in modules/criteoBidAdapter.js and 1 other location - About 40 mins to fix
                              modules/criteoBidAdapter.js on lines 369..373

                              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