prebid/Prebid.js

View on GitHub
modules/carodaBidAdapter.js

Summary

Maintainability
D
2 days
Test Coverage

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

  buildRequests: (validBidRequests, bidderRequest) => {
    topUsableWindow.carodaPageViewId = topUsableWindow.carodaPageViewId || Math.floor(Math.random() * 1e9);
    const pageViewId = topUsableWindow.carodaPageViewId;
    const ortbCommon = getORTBCommon(bidderRequest);
    const priceType =
Severity: Minor
Found in modules/carodaBidAdapter.js - About 1 hr to fix

    Function getImps has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getImps (validBidRequests, common) {
      return validBidRequests.map((bid) => {
        const floorInfo = bid.getFloor
          ? bid.getFloor({ currency: common.currency || 'EUR' })
          : {};
    Severity: Minor
    Found in modules/carodaBidAdapter.js - About 1 hr to fix

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

        interpretResponse: (serverResponse) => {
          if (!serverResponse.body) {
            return;
          }
          const { ok, error } = serverResponse.body
      Severity: Minor
      Found in modules/carodaBidAdapter.js - About 1 hr to fix

        Function getORTBCommon has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getORTBCommon (bidderRequest) {
          let app, site;
          const commonFpd = bidderRequest.ortb2 || {};
          let { user } = commonFpd;
          if (typeof getConfig('app') === 'object') {
        Severity: Minor
        Found in modules/carodaBidAdapter.js - About 1 hr to fix

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

          function getORTBCommon (bidderRequest) {
            let app, site;
            const commonFpd = bidderRequest.ortb2 || {};
            let { user } = commonFpd;
            if (typeof getConfig('app') === 'object') {
          Severity: Minor
          Found in modules/carodaBidAdapter.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 buildRequests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            buildRequests: (validBidRequests, bidderRequest) => {
              topUsableWindow.carodaPageViewId = topUsableWindow.carodaPageViewId || Math.floor(Math.random() * 1e9);
              const pageViewId = topUsableWindow.carodaPageViewId;
              const ortbCommon = getORTBCommon(bidderRequest);
              const priceType =
          Severity: Minor
          Found in modules/carodaBidAdapter.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 3 locations. Consider refactoring.
          Open

            if (typeof getConfig('app') === 'object') {
              app = getConfig('app') || {}
              if (commonFpd.app) {
                mergeDeep(app, commonFpd.app);
              }
          Severity: Major
          Found in modules/carodaBidAdapter.js and 2 other locations - About 4 hrs to fix
          modules/adfBidAdapter.js on lines 37..51
          modules/dianomiBidAdapter.js on lines 84..98

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

          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

              if (bannerParams && bannerParams.sizes) {
                const sizes = parseSizesInput(bannerParams.sizes);
                const format = sizes.map(size => {
                  const [width, height] = size.split('x');
                  const w = parseInt(width, 10);
          Severity: Major
          Found in modules/carodaBidAdapter.js and 2 other locations - About 4 hrs to fix
          modules/adfBidAdapter.js on lines 125..137
          modules/dianomiBidAdapter.js on lines 188..200

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

          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

          function getFirstWithKey (collection, key) {
            for (let i = 0, result; i < collection.length; i++) {
              result = deepAccess(collection[i], key);
              if (result) {
                return result;
          Severity: Major
          Found in modules/carodaBidAdapter.js and 5 other locations - About 1 hr to fix
          modules/adfBidAdapter.js on lines 258..265
          modules/codefuelBidAdapter.js on lines 151..158
          modules/dianomiBidAdapter.js on lines 358..365
          modules/finativeBidAdapter.js on lines 227..234
          modules/outbrainBidAdapter.js on lines 291..298

          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

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

              if (deepAccess(bidderRequest, 'gdprConsent.gdprApplies') !== undefined) {
                deepSetValue(
                  request,
                  'privacy.gdpr_consent',
                  bidderRequest.gdprConsent.consentString
          Severity: Major
          Found in modules/carodaBidAdapter.js and 2 other locations - About 55 mins to fix
          modules/adfBidAdapter.js on lines 168..171
          modules/dianomiBidAdapter.js on lines 222..225

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

          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