prebid/Prebid.js

View on GitHub
modules/kueezBidAdapter.js

Summary

Maintainability
F
3 days
Test Coverage

File kueezBidAdapter.js has 340 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  logWarn,
  logInfo,
  isArray,
  isFn,
Severity: Minor
Found in modules/kueezBidAdapter.js - About 4 hrs to fix

    Function generateSharedParams has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function generateSharedParams(sharedParams, bidderRequest) {
      const {bidderCode} = bidderRequest;
      const {syncEnabled, filterSettings} = config.getConfig('userSync') || {};
      const domain = window.location.hostname;
      const generalBidParams = getBidIdParameter('params', sharedParams);
    Severity: Major
    Found in modules/kueezBidAdapter.js - About 2 hrs to fix

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

      function generateSharedParams(sharedParams, bidderRequest) {
        const {bidderCode} = bidderRequest;
        const {syncEnabled, filterSettings} = config.getConfig('userSync') || {};
        const domain = window.location.hostname;
        const generalBidParams = getBidIdParameter('params', sharedParams);
      Severity: Minor
      Found in modules/kueezBidAdapter.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 generateBidParameters has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function generateBidParameters(bid, bidderRequest) {
        const {params} = bid;
        const mediaType = isBanner(bid) ? BANNER : VIDEO;
        const sizesArray = getSizesArray(bid, mediaType);
        const gpid = deepAccess(bid, `ortb2Imp.ext.gpid`);
      Severity: Minor
      Found in modules/kueezBidAdapter.js - About 1 hr to fix

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

        function parseBidResponses(bids) {
          return bids.map(bid => {
            const bidResponse = {
              cpm: bid.cpm,
              creativeId: bid.requestId,
        Severity: Minor
        Found in modules/kueezBidAdapter.js - About 1 hr to fix

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

          function generateBidParameters(bid, bidderRequest) {
            const {params} = bid;
            const mediaType = isBanner(bid) ? BANNER : VIDEO;
            const sizesArray = getSizesArray(bid, mediaType);
            const gpid = deepAccess(bid, `ortb2Imp.ext.gpid`);
          Severity: Minor
          Found in modules/kueezBidAdapter.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 getUserSyncs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            getUserSyncs: function (syncOptions, serverResponses) {
              const syncs = [];
              for (const response of serverResponses) {
                if (syncOptions.pixelEnabled && isArray(response.body.params.userSyncPixels)) {
                  const pixels = response.body.params.userSyncPixels.map(pixel => {
          Severity: Minor
          Found in modules/kueezBidAdapter.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 populateVideoParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function populateVideoParams(params, bid) {
            const linearity = deepAccess(bid, `mediaTypes.video.linearity`);
            const maxDuration = deepAccess(bid, `mediaTypes.video.maxduration`);
            const minDuration = deepAccess(bid, `mediaTypes.video.minduration`);
            const placement = deepAccess(bid, `mediaTypes.video.placement`);
          Severity: Minor
          Found in modules/kueezBidAdapter.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 6 locations. Consider refactoring.
          Open

          function getSupplyChain(schainObject) {
            if (isEmpty(schainObject)) {
              return '';
            }
            let scStr = `${schainObject.ver},${schainObject.complete}`;
          Severity: Major
          Found in modules/kueezBidAdapter.js and 5 other locations - About 1 day to fix
          modules/minutemediaBidAdapter.js on lines 178..193
          modules/openwebBidAdapter.js on lines 178..193
          modules/publirBidAdapter.js on lines 184..199
          modules/riseBidAdapter.js on lines 185..200
          modules/shinezBidAdapter.js on lines 177..192

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

          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

          function getSizesArray(bid, mediaType) {
            let sizes = []
          
            if (deepAccess(bid, `mediaTypes.${mediaType}.sizes`)) {
              sizes = bid.mediaTypes[mediaType].sizes;
          Severity: Major
          Found in modules/kueezBidAdapter.js and 6 other locations - About 3 hrs to fix
          modules/minutemediaBidAdapter.js on lines 161..171
          modules/openwebBidAdapter.js on lines 161..171
          modules/publirBidAdapter.js on lines 167..177
          modules/riseBidAdapter.js on lines 168..178
          modules/shinezBidAdapter.js on lines 160..170
          modules/stnBidAdapter.js on lines 162..172

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

          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 getSyncMethod(filterSettings, bidderCode) {
            const iframeConfigs = ['all', 'iframe'];
            const pixelConfig = 'image';
            if (filterSettings && iframeConfigs.some(config => isSyncMethodAllowed(filterSettings[config], bidderCode))) {
              return SUPPORTED_SYNC_METHODS.IFRAME;
          Severity: Major
          Found in modules/kueezBidAdapter.js and 5 other locations - About 3 hrs to fix
          modules/minutemediaBidAdapter.js on lines 209..218
          modules/openwebBidAdapter.js on lines 209..218
          modules/riseBidAdapter.js on lines 216..225
          modules/shinezBidAdapter.js on lines 208..217
          modules/stnBidAdapter.js on lines 211..220

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

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

            onBidWon: function (bid) {
              if (bid == null) {
                return;
              }
          
          
          Severity: Major
          Found in modules/kueezBidAdapter.js and 5 other locations - About 1 hr to fix
          modules/minutemediaBidAdapter.js on lines 125..134
          modules/openwebBidAdapter.js on lines 125..134
          modules/riseBidAdapter.js on lines 131..140
          modules/shinezBidAdapter.js on lines 124..133
          modules/stnBidAdapter.js on lines 124..133

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

          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