prebid/Prebid.js

View on GitHub
modules/adpartnerBidAdapter.js

Summary

Maintainability
F
5 days
Test Coverage

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

  getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
    const syncs = [];

    if (!syncOptions.iframeEnabled && !syncOptions.pixelEnabled) {
      return syncs;
Severity: Major
Found in modules/adpartnerBidAdapter.js - About 2 hrs to fix

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

      buildRequests: function (validBidRequests, bidderRequest) {
        // TODO does it make sense to fall back to window.location.href?
        const referer = bidderRequest?.refererInfo?.page || window.location.href;
    
        let bidRequests = [];
    Severity: Minor
    Found in modules/adpartnerBidAdapter.js - About 1 hr to fix

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

        getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
          const syncs = [];
      
          if (!syncOptions.iframeEnabled && !syncOptions.pixelEnabled) {
            return syncs;
      Severity: Minor
      Found in modules/adpartnerBidAdapter.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

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

        getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
          const syncs = [];
      
          if (!syncOptions.iframeEnabled && !syncOptions.pixelEnabled) {
            return syncs;
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 3 days to fix
      modules/mediaimpactBidAdapter.js on lines 149..212

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

      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

        interpretResponse: function (serverResponse, bidRequest) {
          const validBids = JSON.parse(bidRequest.data);
      
          if (typeof serverResponse.body === 'undefined') {
            return [];
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 5 hrs to fix
      modules/mediaimpactBidAdapter.js on lines 91..105

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

      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

        onBidWon: function(data) {
          data.winNotification.forEach(function(unitWon) {
            let adPartnerBidWonUrl = buildUrl({
              protocol: ENDPOINT_PROTOCOL,
              hostname: ENDPOINT_DOMAIN,
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 3 hrs to fix
      modules/mediaimpactBidAdapter.js on lines 129..143

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

      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 (parseInt(validBidRequest.params.partnerId)) {
              bidRequestObject.unitId = 0;
              bidRequestObject.partnerId = parseInt(validBidRequest.params.partnerId);
              beaconParams.partner.push(validBidRequest.params.partnerId);
            }
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 2 hrs to fix
      modules/mediaimpactBidAdapter.js on lines 47..51

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

      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

        joinSizesToString: function(sizes) {
          let res = [];
          sizes.forEach(function(size) {
            res.push(size.join('x'));
          });
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 1 hr to fix
      modules/mediaimpactBidAdapter.js on lines 82..89

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

      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 (parseInt(validBidRequest.params.unitId)) {
              bidRequestObject.unitId = parseInt(validBidRequest.params.unitId);
              beaconParams.tag.push(validBidRequest.params.unitId);
            }
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 1 hr to fix
      modules/mediaimpactBidAdapter.js on lines 42..45

      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

          if (beaconParams.partner.length > 0) {
            beaconParams.partner = beaconParams.partner.join(',');
          } else {
            delete beaconParams.partner;
          }
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 1 hr to fix
      modules/mediaimpactBidAdapter.js on lines 59..63

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 55.

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

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

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

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

      Refactorings

      Further Reading

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

        isBidRequestValid: function (bidRequest) {
          return !!parseInt(bidRequest.params.unitId) || !!parseInt(bidRequest.params.partnerId);
        },
      Severity: Minor
      Found in modules/adpartnerBidAdapter.js and 1 other location - About 45 mins to fix
      modules/mediaimpactBidAdapter.js on lines 13..15

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 50.

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

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

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

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

      Refactorings

      Further Reading

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

          if (ad.adomain && ad.adomain.length > 0) {
            bidObject.meta.advertiserDomains = ad.adomain;
          }
      Severity: Major
      Found in modules/adpartnerBidAdapter.js and 5 other locations - About 35 mins to fix
      modules/ccxBidAdapter.js on lines 128..130
      modules/ixBidAdapter.js on lines 493..495
      modules/outbrainBidAdapter.js on lines 215..217
      modules/telariaBidAdapter.js on lines 255..257
      modules/ttdBidAdapter.js on lines 489..491

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

      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