prebid/Prebid.js

View on GitHub
modules/rubiconBidAdapter.js

Summary

Maintainability
F
2 wks
Test Coverage

File rubiconBidAdapter.js has 1035 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { ortbConverter } from '../libraries/ortbConverter/converter.js';
import { pbsExtensions } from '../libraries/pbsExtensions/pbsExtensions.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/rubiconBidAdapter.js - About 2 days to fix

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

      interpretResponse: function (responseObj, request) {
        responseObj = responseObj.body;
        const {data} = request;
    
        // check overall response
    Severity: Minor
    Found in modules/rubiconBidAdapter.js - About 6 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 applyFPD has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
    Open

    function applyFPD(bidRequest, mediaType, data) {
      const BID_FPD = {
        user: {ext: {data: {...bidRequest.params.visitor}}},
        site: {ext: {data: {...bidRequest.params.inventory}}}
      };
    Severity: Minor
    Found in modules/rubiconBidAdapter.js - About 6 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 applyFPD has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function applyFPD(bidRequest, mediaType, data) {
      const BID_FPD = {
        user: {ext: {data: {...bidRequest.params.visitor}}},
        site: {ext: {data: {...bidRequest.params.inventory}}}
      };
    Severity: Major
    Found in modules/rubiconBidAdapter.js - About 4 hrs to fix

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

        createSlotParams: function(bidRequest, bidderRequest) {
          bidRequest.startTime = new Date().getTime();
      
          const params = bidRequest.params;
      
      
      Severity: Major
      Found in modules/rubiconBidAdapter.js - About 4 hrs to fix

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

          interpretResponse: function (responseObj, request) {
            responseObj = responseObj.body;
            const {data} = request;
        
            // check overall response
        Severity: Major
        Found in modules/rubiconBidAdapter.js - About 3 hrs to fix

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

            createSlotParams: function(bidRequest, bidderRequest) {
              bidRequest.startTime = new Date().getTime();
          
              const params = bidRequest.params;
          
          
          Severity: Minor
          Found in modules/rubiconBidAdapter.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 bidType has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

          function bidType(bid, log = false) {
            // Is it considered video ad unit by rubicon
            let bidTypes = [];
            if (classifiedAsVideo(bid)) {
              // Removed legacy mediaType support. new way using mediaTypes.video object is now required
          Severity: Minor
          Found in modules/rubiconBidAdapter.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 buildRequests has 73 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            buildRequests: function (bidRequests, bidderRequest) {
              // separate video bids because the requests are structured differently
              let requests = [];
              let filteredHttpRequest = [];
              let filteredRequests;
          Severity: Major
          Found in modules/rubiconBidAdapter.js - About 2 hrs to fix

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

              getUserSyncs: function (syncOptions, responses, gdprConsent, uspConsent, gppConsent) {
                if (!hasSynced && syncOptions.iframeEnabled) {
                  // data is only assigned if params are available to pass to syncEndpoint
                  let params = {};
            
            
            Severity: Minor
            Found in modules/rubiconBidAdapter.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 bids has 50 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                let bids = ads.reduce((bids, ad, i) => {
                  (ad.impression_id && lastImpId === ad.impression_id) ? multibid++ : lastImpId = ad.impression_id;
            
                  if (ad.status !== 'ok') {
                    return bids;
            Severity: Minor
            Found in modules/rubiconBidAdapter.js - About 2 hrs to fix

              Function getOrderedParams has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                getOrderedParams: function(params) {
                  const containsTgV = /^tg_v/
                  const containsTgI = /^tg_i/
                  const containsUId = /^eid_|^tpid_/
              
              
              Severity: Minor
              Found in modules/rubiconBidAdapter.js - About 1 hr to fix

                Function bidType has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function bidType(bid, log = false) {
                  // Is it considered video ad unit by rubicon
                  let bidTypes = [];
                  if (classifiedAsVideo(bid)) {
                    // Removed legacy mediaType support. new way using mediaTypes.video object is now required
                Severity: Minor
                Found in modules/rubiconBidAdapter.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                      if (rubiConf.singleRequest !== true) {
                        // bids are not grouped if single request mode is not enabled
                        requests = filteredHttpRequest.concat(bannerBidRequests.map(bidRequest => {
                          const bidParams = spec.createSlotParams(bidRequest, bidderRequest);
                          return {
                  Severity: Critical
                  Found in modules/rubiconBidAdapter.js - About 1 hr to fix

                    Function request has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      request(buildRequest, imps, bidderRequest, context) {
                        const {bidRequests} = context;
                        const data = buildRequest(imps, bidderRequest, context);
                        data.cur = ['USD'];
                        data.test = config.getConfig('debug') ? 1 : 0;
                    Severity: Minor
                    Found in modules/rubiconBidAdapter.js - About 1 hr to fix

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

                        buildRequests: function (bidRequests, bidderRequest) {
                          // separate video bids because the requests are structured differently
                          let requests = [];
                          let filteredHttpRequest = [];
                          let filteredRequests;
                      Severity: Minor
                      Found in modules/rubiconBidAdapter.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 parseSizes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function parseSizes(bid, mediaType) {
                        let params = bid.params;
                        if (mediaType === VIDEO) {
                          let size = [];
                          if (params.video && params.video.playerWidth && params.video.playerHeight) {
                      Severity: Minor
                      Found in modules/rubiconBidAdapter.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 renderBid has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function renderBid(bid) {
                        // hide existing ad units
                        const adUnitElement = document.getElementById(bid.adUnitCode);
                        hideGoogleAdsDiv(adUnitElement);
                        hideSmartAdServerIframe(adUnitElement);
                      Severity: Minor
                      Found in modules/rubiconBidAdapter.js - About 1 hr to fix

                        Function parseSizes has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function parseSizes(bid, mediaType) {
                          let params = bid.params;
                          if (mediaType === VIDEO) {
                            let size = [];
                            if (params.video && params.video.playerWidth && params.video.playerHeight) {
                        Severity: Minor
                        Found in modules/rubiconBidAdapter.js - About 1 hr to fix

                          Consider simplifying this complex logical expression.
                          Open

                                if (associatedBidRequest && typeof associatedBidRequest === 'object') {
                                  let bid = {
                                    requestId: associatedBidRequest.bidId,
                                    currency: 'USD',
                                    creativeId: ad.creative_id || `${ad.network || ''}-${ad.advertiser || ''}`,
                          Severity: Major
                          Found in modules/rubiconBidAdapter.js - About 40 mins to fix

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

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

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

                                request(buildRequest, imps, bidderRequest, context) {
                                  const {bidRequests} = context;
                                  const data = buildRequest(imps, bidderRequest, context);
                                  data.cur = ['USD'];
                                  data.test = config.getConfig('debug') ? 1 : 0;
                              Severity: Minor
                              Found in modules/rubiconBidAdapter.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 isBidRequestValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                              Open

                                isBidRequestValid: function (bid) {
                                  let valid = true;
                                  if (typeof bid.params !== 'object') {
                                    return false;
                                  }
                              Severity: Minor
                              Found in modules/rubiconBidAdapter.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 valid && hasBannerOrNativeMediaType;
                              Severity: Major
                              Found in modules/rubiconBidAdapter.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

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

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

                                    if (mediaType === VIDEO) {
                                      let size = [];
                                      if (params.video && params.video.playerWidth && params.video.playerHeight) {
                                        size = [
                                          params.video.playerWidth,
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 2 other locations - About 1 day to fix
                                  modules/gothamadsBidAdapter.js on lines 307..320
                                  modules/luponmediaBidAdapter.js on lines 559..572

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

                                  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

                                  export function masSizeOrdering(sizes) {
                                    const MAS_SIZE_PRIORITY = [15, 2, 9];
                                  
                                    return sizes.sort((first, second) => {
                                      // sort by MAS_SIZE_PRIORITY priority order
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 5 hrs to fix
                                  modules/luponmediaBidAdapter.js on lines 257..278

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

                                  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 (Array.isArray(params.sizes)) {
                                      sizes = params.sizes;
                                    } else if (typeof deepAccess(bid, 'mediaTypes.banner.sizes') !== 'undefined') {
                                      sizes = mapSizes(bid.mediaTypes.banner.sizes);
                                    } else if (Array.isArray(bid.sizes) && bid.sizes.length > 0) {
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 4 hrs to fix
                                  modules/luponmediaBidAdapter.js on lines 576..584

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 134.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                  function _getPageUrl(bidRequest, bidderRequest) {
                                    let pageUrl;
                                    if (bidRequest.params.referrer) {
                                      pageUrl = bidRequest.params.referrer;
                                    } else {
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 2 hrs to fix
                                  modules/axonixBidAdapter.js on lines 27..36

                                  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

                                              data: spec.getOrderedParams(combinedSlotParams).reduce((paramString, key) => {
                                                const propValue = combinedSlotParams[key];
                                                return ((isStr(propValue) && propValue !== '') || isNumber(propValue)) ? `${paramString}${encodeParam(key, propValue)}&` : paramString;
                                              }, '') + `slots=${bidsInGroup.length}&rand=${Math.random()}`,
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 2 hrs to fix
                                  modules/rubiconBidAdapter.js on lines 337..340

                                  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

                                            data: spec.getOrderedParams(bidParams).reduce((paramString, key) => {
                                              const propValue = bidParams[key];
                                              return ((isStr(propValue) && propValue !== '') || isNumber(propValue)) ? `${paramString}${encodeParam(key, propValue)}&` : paramString;
                                            }, '') + `slots=1&rand=${Math.random()}`,
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 2 hrs to fix
                                  modules/rubiconBidAdapter.js on lines 367..370

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

                                        if (gdprConsent) {
                                          if (typeof gdprConsent.gdprApplies === 'boolean') {
                                            params['gdpr'] = Number(gdprConsent.gdprApplies);
                                          }
                                          if (typeof gdprConsent.consentString === 'string') {
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 3 other locations - About 2 hrs to fix
                                  modules/admaticBidAdapter.js on lines 160..167
                                  modules/dianomiBidAdapter.js on lines 305..312
                                  modules/kubientBidAdapter.js on lines 126..133

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

                                  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 mapSizes(sizes) {
                                    return parseSizesInput(sizes)
                                    // map sizes while excluding non-matches
                                      .reduce((result, size) => {
                                        let mappedSize = parseInt(sizeMap[size], 10);
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 1 hr to fix
                                  modules/luponmediaBidAdapter.js on lines 545..555

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

                                  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 bidFirstPartyData = {
                                        user: {ext: {data: {...bidRequest.params.visitor}}},
                                        site: {ext: {data: {...bidRequest.params.inventory}}}
                                      };
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 1 hr to fix
                                  modules/rubiconBidAdapter.js on lines 907..910

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

                                  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 BID_FPD = {
                                      user: {ext: {data: {...bidRequest.params.visitor}}},
                                      site: {ext: {data: {...bidRequest.params.inventory}}}
                                    };
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 1 hr to fix
                                  modules/rubiconBidAdapter.js on lines 1325..1328

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

                                  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

                                    isValid = schain.nodes.reduce((status, node) => {
                                      if (!status) return status;
                                      return requiredFields.every(field => node.hasOwnProperty(field));
                                    }, true);
                                  Severity: Major
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 1 hr to fix
                                  modules/onetagBidAdapter.js on lines 426..429

                                  Duplicated Code

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

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

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

                                  Tuning

                                  This issue has a mass of 59.

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

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

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

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

                                  Refactorings

                                  Further Reading

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

                                        try {
                                          floorInfo = bidRequest.getFloor({
                                            currency: 'USD',
                                            mediaType: 'banner',
                                            size: '*'
                                  Severity: Minor
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 55 mins to fix
                                  modules/kargoBidAdapter.js on lines 501..509

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

                                  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

                                        auto: [
                                          {max: 5.00, increment: 0.05},
                                          {min: 5.00, max: 10.00, increment: 0.10},
                                          {min: 10.00, max: 20.00, increment: 0.50}
                                        ],
                                  Severity: Minor
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 50 mins to fix
                                  modules/rubiconBidAdapter.js on lines 1222..1226

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

                                  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

                                        dense: [
                                          {max: 3.00, increment: 0.01},
                                          {min: 3.00, max: 8.00, increment: 0.05},
                                          {min: 8.00, max: 20.00, increment: 0.50}
                                        ],
                                  Severity: Minor
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 50 mins to fix
                                  modules/rubiconBidAdapter.js on lines 1217..1221

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

                                  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

                                        data['rp_hard_floor'] = typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseInt(floorInfo.floor)) ? floorInfo.floor : undefined;
                                  Severity: Minor
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 40 mins to fix
                                  modules/kargoBidAdapter.js on lines 510..510

                                  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

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

                                        if (gppConsent?.gppString) {
                                          params['gpp'] = gppConsent.gppString;
                                          params['gpp_sid'] = gppConsent.applicableSections?.toString();
                                        }
                                  Severity: Minor
                                  Found in modules/rubiconBidAdapter.js and 1 other location - About 40 mins to fix
                                  modules/admaticBidAdapter.js on lines 173..176

                                  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