prebid/Prebid.js

View on GitHub
modules/adagioBidAdapter.js

Summary

Maintainability
F
2 wks
Test Coverage

File adagioBidAdapter.js has 1001 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {find} from '../src/polyfill.js';
import {
  cleanObj,
  deepAccess,
  deepClone,
Severity: Major
Found in modules/adagioBidAdapter.js - About 2 days to fix

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

      buildRequests(validBidRequests, bidderRequest) {
        // convert Native ORTB definition to old-style prebid native definition
        validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
    
        const secure = (location.protocol === 'https:') ? 1 : 0;
    Severity: Minor
    Found in modules/adagioBidAdapter.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 buildRequests has 172 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      buildRequests(validBidRequests, bidderRequest) {
        // convert Native ORTB definition to old-style prebid native definition
        validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
    
        const secure = (location.protocol === 'https:') ? 1 : 0;
    Severity: Major
    Found in modules/adagioBidAdapter.js - About 6 hrs to fix

      Function adUnits has 110 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const adUnits = validBidRequests.map(rawBidRequest => {
            const bidRequest = deepClone(rawBidRequest);
      
            // Fix https://github.com/prebid/Prebid.js/issues/9781
            bidRequest.auctionId = aucId
      Severity: Major
      Found in modules/adagioBidAdapter.js - About 4 hrs to fix

        Function _parseNativeBidResponse has 92 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function _parseNativeBidResponse(bid) {
          if (!bid.admNative || !Array.isArray(bid.admNative.assets)) {
            logError(`${LOG_PREFIX} Invalid native response`);
            return;
          }
        Severity: Major
        Found in modules/adagioBidAdapter.js - About 3 hrs to fix

          Function _parseNativeBidResponse has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          function _parseNativeBidResponse(bid) {
            if (!bid.admNative || !Array.isArray(bid.admNative.assets)) {
              logError(`${LOG_PREFIX} Invalid native response`);
              return;
            }
          Severity: Minor
          Found in modules/adagioBidAdapter.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 getSlotPosition has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          function getSlotPosition(adUnitElementId) {
            if (!adUnitElementId) {
              return '';
            }
          
          
          Severity: Minor
          Found in modules/adagioBidAdapter.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

          ORTB_VIDEO_PARAMS has 23 functions (exceeds 20 allowed). Consider refactoring.
          Open

          export const ORTB_VIDEO_PARAMS = {
            'mimes': (value) => Array.isArray(value) && value.length > 0 && value.every(v => typeof v === 'string'),
            'minduration': (value) => isInteger(value),
            'maxduration': (value) => isInteger(value),
            'protocols': (value) => isArrayOfNums(value),
          Severity: Minor
          Found in modules/adagioBidAdapter.js - About 2 hrs to fix

            Function getSlotPosition has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getSlotPosition(adUnitElementId) {
              if (!adUnitElementId) {
                return '';
              }
            
            
            Severity: Major
            Found in modules/adagioBidAdapter.js - About 2 hrs to fix

              Function GlobalExchange has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export const GlobalExchange = (function() {
                let features;
                let exchangeData = {};
              
                return {
              Severity: Minor
              Found in modules/adagioBidAdapter.js - About 1 hr to fix

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

                  interpretResponse(serverResponse, bidRequest) {
                    let bidResponses = [];
                    try {
                      const response = serverResponse.body;
                      if (response) {
                Severity: Minor
                Found in modules/adagioBidAdapter.js - About 1 hr to fix

                  Consider simplifying this complex logical expression.
                  Open

                    } else if (canAccessTopWindow()) {
                      try {
                        // window.top based computing
                        const wt = getWindowTop();
                        const d = wt.document;
                  Severity: Critical
                  Found in modules/adagioBidAdapter.js - About 1 hr to fix

                    Function _getFloors has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function _getFloors(bidRequest) {
                      if (!isFn(bidRequest.getFloor)) {
                        return false;
                      }
                    
                    
                    Severity: Minor
                    Found in modules/adagioBidAdapter.js - About 1 hr to fix

                      Function requests has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const requests = Object.keys(groupedAdUnits).map(organizationId => {
                            return {
                              method: 'POST',
                              url: ENDPOINT,
                              data: {
                      Severity: Minor
                      Found in modules/adagioBidAdapter.js - About 1 hr to fix

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

                          bootstrapPlayer: function(bid) {
                            const rendererCode = bid.outstreamRendererCode;
                        
                            const config = {
                              code: bid.adUnitCode,
                        Severity: Minor
                        Found in modules/adagioBidAdapter.js - About 1 hr to fix

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

                          function storeRequestInAdagioNS(bidRequest) {
                            const w = getCurrentWindow();
                            // Store adUnits config.
                            // If an adUnitCode has already been stored, it will be replaced.
                            w.ADAGIO = w.ADAGIO || {};
                          Severity: Minor
                          Found in modules/adagioBidAdapter.js - About 1 hr to fix

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

                            function _buildVideoBidRequest(bidRequest) {
                              const videoAdUnitParams = deepAccess(bidRequest, 'mediaTypes.video', {});
                              const videoBidderParams = deepAccess(bidRequest, 'params.video', {});
                              const computedParams = {};
                            
                            
                            Severity: Minor
                            Found in modules/adagioBidAdapter.js - About 1 hr to fix

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

                              function getViewPortDimensions() {
                                if (!isSafeFrameWindow() && !canAccessTopWindow()) {
                                  return '';
                                }
                              
                              
                              Severity: Minor
                              Found in modules/adagioBidAdapter.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

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

                              export const GlobalExchange = (function() {
                                let features;
                                let exchangeData = {};
                              
                                return {
                              Severity: Minor
                              Found in modules/adagioBidAdapter.js - About 45 mins to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Avoid deeply nested control flow statements.
                              Open

                                              if (mediaTypeContext === OUTSTREAM) {
                                                bidObj.outstreamRendererCode = deepAccess(bidReq, 'params.rendererCode', BB_RENDERER_DEFAULT)
                              
                                                if (deepAccess(bidReq, 'mediaTypes.video.skip')) {
                                                  const skipOffset = deepAccess(bidReq, 'mediaTypes.video.skipafter', 5) // default 5s.
                              Severity: Major
                              Found in modules/adagioBidAdapter.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                if (!bidObj.vastUrl && bidObj.vastXml) {
                                                  bidObj.vastUrl = 'data:text/xml;charset=utf-8;base64,' + window.btoa(bidObj.vastXml.replace(/\\"/g, '"'));
                                                }
                                Severity: Major
                                Found in modules/adagioBidAdapter.js - About 45 mins to fix

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

                                  export function setExtraParam(bid, paramName) {
                                    bid.params = bid.params || {};
                                  
                                    // eslint-disable-next-line
                                    if (!!(bid.params[paramName])) {
                                  Severity: Minor
                                  Found in modules/adagioBidAdapter.js - About 45 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

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

                                  function getElementFromTopWindow(element, currentWindow) {
                                    try {
                                      if (getWindowTop() === currentWindow) {
                                        if (!element.getAttribute('id')) {
                                          element.setAttribute('id', `adg-${getUniqueIdentifierStr()}`);
                                  Severity: Minor
                                  Found in modules/adagioBidAdapter.js - About 45 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

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

                                  function storeRequestInAdagioNS(bidRequest) {
                                    const w = getCurrentWindow();
                                    // Store adUnits config.
                                    // If an adUnitCode has already been stored, it will be replaced.
                                    w.ADAGIO = w.ADAGIO || {};
                                  Severity: Minor
                                  Found in modules/adagioBidAdapter.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 adagioScriptFromLocalStorageCb has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  export function adagioScriptFromLocalStorageCb(ls) {
                                    try {
                                      if (!ls) {
                                        logWarn(`${LOG_PREFIX} script not found.`);
                                        return;
                                  Severity: Minor
                                  Found in modules/adagioBidAdapter.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 bootstrapPlayer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    bootstrapPlayer: function(bid) {
                                      const rendererCode = bid.outstreamRendererCode;
                                  
                                      const config = {
                                        code: bid.adUnitCode,
                                  Severity: Minor
                                  Found in modules/adagioBidAdapter.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 '';
                                  Severity: Major
                                  Found in modules/adagioBidAdapter.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

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

                                      Avoid too many return statements within this function.
                                      Open

                                        return `${position.x}x${position.y}`;
                                      Severity: Major
                                      Found in modules/adagioBidAdapter.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

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

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

                                          function autoFillParams(bid) {
                                            // adUnitElementId …
                                            const adgGlobalConf = config.getConfig('adagio') || {};
                                          
                                            bid.params = bid.params || {};
                                          Severity: Minor
                                          Found in modules/adagioBidAdapter.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 interpretResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                          Open

                                            interpretResponse(serverResponse, bidRequest) {
                                              let bidResponses = [];
                                              try {
                                                const response = serverResponse.body;
                                                if (response) {
                                          Severity: Minor
                                          Found in modules/adagioBidAdapter.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 (isSafeFrameWindow()) {
                                              const ws = getWindowSelf();
                                          
                                              if (typeof ws.$sf.ext.geom !== 'function') {
                                                logWarn(LOG_PREFIX, 'Unable to compute from safeframe api.');
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 5 hrs to fix
                                          modules/adagioBidAdapter.js on lines 751..812

                                          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 (isSafeFrameWindow()) {
                                              const ws = getWindowSelf();
                                          
                                              if (typeof ws.$sf.ext.geom !== 'function') {
                                                logWarn(LOG_PREFIX, 'Unable to compute from safeframe api.');
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 5 hrs to fix
                                          modules/adagioBidAdapter.js on lines 713..735

                                          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

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

                                              bid.admNative.eventtrackers.forEach(tracker => {
                                                // Only Impression events are supported. Prebid does not support Viewability events yet.
                                                if (tracker.event !== 1) {
                                                  return;
                                                }
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 5 hrs to fix
                                          modules/mediakeysBidAdapter.js on lines 559..582

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

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                              } else if (asset.data) {
                                                addAssetDataValue(asset.data)
                                              } else if (asset.img) {
                                                switch (asset.img.type) {
                                                  case 1:
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 4 hrs to fix
                                          modules/discoveryBidAdapter.js on lines 611..630

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 134.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          function getDomLoadingDuration() {
                                            let domLoadingDuration = -1;
                                            let performance;
                                          
                                            performance = (canAccessTopWindow()) ? getWindowTop().performance : getWindowSelf().performance;
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 4 hrs to fix
                                          modules/bliinkBidAdapter.js on lines 139..153

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

                                          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 adUnit = {
                                                  adUnitCode: bidRequest.adUnitCode,
                                                  auctionId: bidRequest.auctionId,
                                                  bidder: bidRequest.bidder,
                                                  bidId: bidRequest.bidId,
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 3 hrs to fix
                                          modules/adheseBidAdapter.js on lines 214..214

                                          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 (Array.isArray(videoAdUnitParams.playerSize)) {
                                              const tempSize = (Array.isArray(videoAdUnitParams.playerSize[0])) ? videoAdUnitParams.playerSize[0] : videoAdUnitParams.playerSize;
                                              computedParams.w = tempSize[0];
                                              computedParams.h = tempSize[1];
                                            }
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 2 hrs to fix
                                          modules/mediakeysBidAdapter.js on lines 397..401

                                          Duplicated Code

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

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

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

                                          Tuning

                                          This issue has a mass of 93.

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

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

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

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

                                          Refactorings

                                          Further Reading

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

                                          function _getGppConsent(bidderRequest) {
                                            let gpp = deepAccess(bidderRequest, 'gppConsent.gppString')
                                            let gppSid = deepAccess(bidderRequest, 'gppConsent.applicableSections')
                                          
                                            if (!gpp || !gppSid) {
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 2 hrs to fix
                                          modules/insticatorBidAdapter.js on lines 215..224

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

                                          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 (!bidObj.vastUrl && bidObj.vastXml) {
                                                            bidObj.vastUrl = 'data:text/xml;charset=utf-8;base64,' + window.btoa(bidObj.vastXml.replace(/\\"/g, '"'));
                                                          }
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 1 hr to fix
                                          modules/insticatorBidAdapter.js on lines 422..424

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

                                              if (bid.vastXml) {
                                                config.vastXml = bid.vastXml;
                                              } else if (bid.vastUrl) {
                                                config.vastUrl = bid.vastUrl;
                                              }
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 2 other locations - About 55 mins to fix
                                          libraries/ortbConverter/processors/banner.js on lines 33..37
                                          modules/vidoomyBidAdapter.js on lines 256..260

                                          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

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

                                            'mimes': (value) => Array.isArray(value) && value.length > 0 && value.every(v => typeof v === 'string'),
                                          Severity: Major
                                          Found in modules/adagioBidAdapter.js and 2 other locations - About 50 mins to fix
                                          modules/deepintentBidAdapter.js on lines 10..10
                                          modules/sovrnBidAdapter.js on lines 23..23

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

                                          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.features && bidRequest.features.print_number) {
                                              printNumber = bidRequest.features.print_number;
                                            } else if (bidRequest.params.features && bidRequest.params.features.print_number) {
                                              printNumber = bidRequest.params.features.print_number;
                                            }
                                          Severity: Minor
                                          Found in modules/adagioBidAdapter.js and 1 other location - About 50 mins to fix
                                          modules/ablidaBidAdapter.js on lines 45..49

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

                                          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