prebid/Prebid.js

View on GitHub
libraries/teqblazeUtils/bidderUtils.js

Summary

Maintainability
F
1 wk
Test Coverage

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

export const getUserSyncs = (syncUrl) => (syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) => {
  const type = syncOptions.iframeEnabled ? 'iframe' : 'image';
  let url = syncUrl + `/${type}?pbjs=1`;

  if (gdprConsent && gdprConsent.consentString) {
Severity: Minor
Found in libraries/teqblazeUtils/bidderUtils.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 buildRequestsBase has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const buildRequestsBase = (config) => {
  const { adUrl, validBidRequests, bidderRequest } = config;
  const placementProcessingFunction = config.placementProcessingFunction || buildPlacementProcessingFunction();
  const device = deepAccess(bidderRequest, 'ortb2.device');
  const page = deepAccess(bidderRequest, 'refererInfo.page', '');
Severity: Minor
Found in libraries/teqblazeUtils/bidderUtils.js - About 1 hr to fix

    Function createBasePlacement has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const createBasePlacement = (bid) => {
      const { bidId, mediaTypes, transactionId, userIdAsEids } = bid;
      const schain = bid.schain || {};
      const bidfloor = getBidFloor(bid);
    
    
    Severity: Minor
    Found in libraries/teqblazeUtils/bidderUtils.js - About 1 hr to fix

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

      const createBasePlacement = (bid) => {
        const { bidId, mediaTypes, transactionId, userIdAsEids } = bid;
        const schain = bid.schain || {};
        const bidfloor = getBidFloor(bid);
      
      
      Severity: Minor
      Found in libraries/teqblazeUtils/bidderUtils.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 buildRequestsBase has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      export const buildRequestsBase = (config) => {
        const { adUrl, validBidRequests, bidderRequest } = config;
        const placementProcessingFunction = config.placementProcessingFunction || buildPlacementProcessingFunction();
        const device = deepAccess(bidderRequest, 'ortb2.device');
        const page = deepAccess(bidderRequest, 'refererInfo.page', '');
      Severity: Minor
      Found in libraries/teqblazeUtils/bidderUtils.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 isBidResponseValid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      const isBidResponseValid = (bid) => {
        if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
          return false;
        }
      
      
      Severity: Minor
      Found in libraries/teqblazeUtils/bidderUtils.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

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

        if (mediaTypes && mediaTypes[BANNER]) {
          placement.adFormat = BANNER;
          placement.sizes = mediaTypes[BANNER].sizes;
        } else if (mediaTypes && mediaTypes[VIDEO]) {
          placement.adFormat = VIDEO;
      Severity: Major
      Found in libraries/teqblazeUtils/bidderUtils.js and 1 other location - About 2 days to fix
      modules/appushBidAdapter.js on lines 48..72

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

      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

      export const getUserSyncs = (syncUrl) => (syncOptions, serverResponses, gdprConsent, uspConsent, gppConsent) => {
        const type = syncOptions.iframeEnabled ? 'iframe' : 'image';
        let url = syncUrl + `/${type}?pbjs=1`;
      
        if (gdprConsent && gdprConsent.consentString) {
      Severity: Major
      Found in libraries/teqblazeUtils/bidderUtils.js and 1 other location - About 1 day to fix
      modules/axisBidAdapter.js on lines 50..76

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

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

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

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

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

      Refactorings

      Further Reading

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

      const isBidResponseValid = (bid) => {
        if (!bid.requestId || !bid.cpm || !bid.creativeId || !bid.ttl || !bid.currency) {
          return false;
        }
      
      
      Severity: Major
      Found in libraries/teqblazeUtils/bidderUtils.js and 1 other location - About 6 hrs to fix
      modules/appushBidAdapter.js on lines 11..26

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

      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 (mediaTypes && mediaTypes[BANNER]) {
          valid = valid && Boolean(mediaTypes[BANNER] && mediaTypes[BANNER].sizes);
        } else if (mediaTypes && mediaTypes[VIDEO]) {
          valid = valid && Boolean(mediaTypes[VIDEO] && mediaTypes[VIDEO].playerSize);
        } else if (mediaTypes && mediaTypes[NATIVE]) {
      Severity: Major
      Found in libraries/teqblazeUtils/bidderUtils.js and 1 other location - About 5 hrs to fix
      modules/appushBidAdapter.js on lines 103..111

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

      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 (bidderRequest.gppConsent) {
          request.gpp = bidderRequest.gppConsent.gppString;
          request.gpp_sid = bidderRequest.gppConsent.applicableSections;
        } else if (bidderRequest.ortb2?.regs?.gpp) {
          request.gpp = bidderRequest.ortb2.regs.gpp;
      Severity: Major
      Found in libraries/teqblazeUtils/bidderUtils.js and 2 other locations - About 4 hrs to fix
      libraries/riseUtils/index.js on lines 308..314
      libraries/vidazooUtils/bidderUtils.js on lines 316..322

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

      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 (placementId) {
          placement.placementId = placementId;
          placement.type = 'publisher';
        } else if (endpointId) {
          placement.endpointId = endpointId;
      Severity: Major
      Found in libraries/teqblazeUtils/bidderUtils.js and 1 other location - About 1 hr to fix
      modules/appushBidAdapter.js on lines 40..46

      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

      There are no issues that match your filters.

      Category
      Status