prebid/Prebid.js

View on GitHub
modules/radsBidAdapter.js

Summary

Maintainability
F
5 days
Test Coverage

Function prepareExtraParams has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

function prepareExtraParams(params, payload, bidderRequest, bidRequest) {
  if (params.pfilter !== undefined) {
    payload.pfilter = params.pfilter;
  }

Severity: Minor
Found in modules/radsBidAdapter.js - About 1 hr to fix

Cognitive Complexity

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

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

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

Further reading

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

  buildRequests: function(validBidRequests, bidderRequest) {
    return validBidRequests.map(bidRequest => {
      const params = bidRequest.params;
      const placementId = params.placement;

Severity: Minor
Found in modules/radsBidAdapter.js - About 1 hr to fix

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

      buildRequests: function(validBidRequests, bidderRequest) {
        return validBidRequests.map(bidRequest => {
          const params = bidRequest.params;
          const placementId = params.placement;
    
    
    Severity: Minor
    Found in modules/radsBidAdapter.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 prepareExtraParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function prepareExtraParams(params, payload, bidderRequest, bidRequest) {
      if (params.pfilter !== undefined) {
        payload.pfilter = params.pfilter;
      }
    
    
    Severity: Minor
    Found in modules/radsBidAdapter.js - About 1 hr to fix

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

        getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
          if (!serverResponses || serverResponses.length === 0) {
            return [];
          }
      
      
      Severity: Minor
      Found in modules/radsBidAdapter.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 interpretResponse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        interpretResponse: function(serverResponse, bidRequest) {
          const bidResponses = [];
          const response = serverResponse.body;
          const crid = response.crid || 0;
          const cpm = response.cpm / 1000000 || 0;
      Severity: Minor
      Found in modules/radsBidAdapter.js - About 1 hr to fix

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

        function objectToQueryString(obj, prefix) {
          let str = [];
          let p;
          for (p in obj) {
            if (obj.hasOwnProperty(p)) {
        Severity: Minor
        Found in modules/radsBidAdapter.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 getUserSyncs has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
            if (!serverResponses || serverResponses.length === 0) {
              return [];
            }
        
        
        Severity: Minor
        Found in modules/radsBidAdapter.js - About 1 hr to fix

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

            interpretResponse: function(serverResponse, bidRequest) {
              const bidResponses = [];
              const response = serverResponse.body;
              const crid = response.crid || 0;
              const cpm = response.cpm / 1000000 || 0;
          Severity: Minor
          Found in modules/radsBidAdapter.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

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

            getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
              if (!serverResponses || serverResponses.length === 0) {
                return [];
              }
          
          
          Severity: Major
          Found in modules/radsBidAdapter.js and 1 other location - About 1 day to fix
          modules/dspxBidAdapter.js on lines 226..257

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

          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 bidResponses = [];
              const response = serverResponse.body;
              const crid = response.crid || 0;
              const cpm = response.cpm / 1000000 || 0;
          Severity: Major
          Found in modules/radsBidAdapter.js and 1 other location - About 1 day to fix
          modules/stvBidAdapter.js on lines 128..161

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

          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 objectToQueryString(obj, prefix) {
            let str = [];
            let p;
            for (p in obj) {
              if (obj.hasOwnProperty(p)) {
          Severity: Major
          Found in modules/radsBidAdapter.js and 1 other location - About 5 hrs to fix
          modules/dspxBidAdapter.js on lines 267..280

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

          function parseSize(size) {
            let sizeObj = {}
            sizeObj.width = parseInt(size[0], 10);
            sizeObj.height = parseInt(size[1], 10);
            return sizeObj;
          Severity: Major
          Found in modules/radsBidAdapter.js and 2 other locations - About 1 hr to fix
          modules/dspxBidAdapter.js on lines 337..342
          modules/stvBidAdapter.js on lines 339..344

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

          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

          function appendToUrl(url, what) {
            if (!what) {
              return url;
            }
            return url + (url.indexOf('?') !== -1 ? '&' : '?') + what;
          Severity: Major
          Found in modules/radsBidAdapter.js and 2 other locations - About 55 mins to fix
          modules/dspxBidAdapter.js on lines 260..265
          modules/stvBidAdapter.js on lines 198..203

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 53.

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

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

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

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

          Refactorings

          Further Reading

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

              if (payload.pfilter !== undefined) {
                payload.pfilter.gdpr_consent = bidderRequest.gdprConsent.consentString;
                payload.pfilter.gdpr = bidderRequest.gdprConsent.gdprApplies;
              } else {
                payload.pfilter = {
          Severity: Major
          Found in modules/radsBidAdapter.js and 6 other locations - About 45 mins to fix
          modules/dspxBidAdapter.js on lines 75..78
          modules/exadsBidAdapter.js on lines 131..134
          modules/nextMillenniumBidAdapter.js on lines 320..323
          modules/pubmaticBidAdapter.js on lines 998..1001
          modules/sharethroughBidAdapter.js on lines 87..93
          modules/trafficgateBidAdapter.js on lines 55..58

          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

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

          function isBannerRequest(bid) {
            return bid.mediaType === 'banner' || !!deepAccess(bid, 'mediaTypes.banner') || !isVideoRequest(bid);
          }
          Severity: Minor
          Found in modules/radsBidAdapter.js and 2 other locations - About 35 mins to fix
          modules/dspxBidAdapter.js on lines 288..290
          modules/stvBidAdapter.js on lines 300..302

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

          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