prebid/Prebid.js

View on GitHub
modules/onomagicBidAdapter.js

Summary

Maintainability
F
1 wk
Test Coverage

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

function buildRequests(bidReqs, bidderRequest) {
  try {
    let referrer = '';
    if (bidderRequest && bidderRequest.refererInfo) {
      referrer = bidderRequest.refererInfo.page;
Severity: Major
Found in modules/onomagicBidAdapter.js - About 2 hrs to fix

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

    function interpretResponse(serverResponse) {
      if (!serverResponse.body || typeof serverResponse.body != 'object') {
        logWarn('Onomagic server returned empty/non-json response: ' + JSON.stringify(serverResponse.body));
        return [];
      }
    Severity: Minor
    Found in modules/onomagicBidAdapter.js - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

          if (id &&
            seatbid &&
            seatbid.length > 0 &&
            seatbid[0].bid &&
            seatbid[0].bid.length > 0) {
      Severity: Major
      Found in modules/onomagicBidAdapter.js - About 1 hr to fix

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

        function interpretResponse(serverResponse) {
          if (!serverResponse.body || typeof serverResponse.body != 'object') {
            logWarn('Onomagic server returned empty/non-json response: ' + JSON.stringify(serverResponse.body));
            return [];
          }
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 1 other location - About 1 day to fix
        modules/brightcomBidAdapter.js on lines 134..169

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

        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

            _each(bidReqs, function (bid) {
              let bidSizes = (bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes) || bid.sizes;
              bidSizes = ((isArray(bidSizes) && isArray(bidSizes[0])) ? bidSizes : [bidSizes]);
              bidSizes = bidSizes.filter(size => isArray(size));
              const processedSizes = bidSizes.map(size => ({w: parseInt(size[0], 10), h: parseInt(size[1], 10)}));
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 1 other location - About 1 day to fix
        modules/brightcomBidAdapter.js on lines 40..68

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

        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 _getIntersectionOfRects(rects) {
          const bbox = {
            left: rects[0].left,
            right: rects[0].right,
            top: rects[0].top,
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 6 other locations - About 1 day to fix
        libraries/percentInView/percentInView.js on lines 15..40
        modules/33acrossBidAdapter.js on lines 587..615
        modules/brightcomBidAdapter.js on lines 231..259
        modules/brightcomSSPBidAdapter.js on lines 257..282
        modules/marsmediaBidAdapter.js on lines 412..440
        modules/underdogmediaBidAdapter.js on lines 335..363

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

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

        function _getPercentInView(element, topWin, { w, h } = {}) {
          const elementBoundingBox = _getBoundingBox(element, { w, h });
        
          // Obtain the intersection of the element and the viewport
          const elementInViewBoundingBox = _getIntersectionOfRects([ {
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 3 other locations - About 7 hrs to fix
        modules/brightcomBidAdapter.js on lines 261..285
        modules/brightcomSSPBidAdapter.js on lines 284..305
        modules/underdogmediaBidAdapter.js on lines 272..303

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

        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 _getBoundingBox(element, { w, h } = {}) {
          let { width, height, left, top, right, bottom } = element.getBoundingClientRect();
        
          if ((width === 0 || height === 0) && w && h) {
            width = w;
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 6 other locations - About 6 hrs to fix
        libraries/percentInView/percentInView.js on lines 2..13
        modules/33acrossBidAdapter.js on lines 574..585
        modules/brightcomBidAdapter.js on lines 218..229
        modules/brightcomSSPBidAdapter.js on lines 244..255
        modules/marsmediaBidAdapter.js on lines 399..410
        modules/underdogmediaBidAdapter.js on lines 305..333

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

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

        function _getBidFloor(bid) {
          if (!isFn(bid.getFloor)) {
            return bid.params.bidFloor ? bid.params.bidFloor : null;
          }
        
        
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 10 other locations - About 4 hrs to fix
        modules/brightcomBidAdapter.js on lines 287..301
        modules/brightcomSSPBidAdapter.js on lines 307..319
        modules/goldbachBidAdapter.js on lines 1117..1131
        modules/mediafuseBidAdapter.js on lines 1105..1119
        modules/nextrollBidAdapter.js on lines 197..212
        modules/omsBidAdapter.js on lines 269..281
        modules/pixfutureBidAdapter.js on lines 342..356
        modules/proxistoreBidAdapter.js on lines 161..175
        modules/pstudioBidAdapter.js on lines 419..433
        modules/winrBidAdapter.js on lines 577..591

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

        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

        function isBidRequestValid(bid) {
          if (bid.bidder !== BIDDER_CODE || typeof bid.params === 'undefined') {
            return false;
          }
        
        
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 1 other location - About 1 hr to fix
        modules/brightcomBidAdapter.js on lines 122..132

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

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

        function _getViewability(element, topWin, { w, h } = {}) {
          return getWindowTop().document.visibilityState === 'visible'
            ? _getPercentInView(element, topWin, { w, h })
            : 0;
        }
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 3 other locations - About 1 hr to fix
        modules/brightcomBidAdapter.js on lines 200..204
        modules/brightcomSSPBidAdapter.js on lines 228..230
        modules/omsBidAdapter.js on lines 244..246

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

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

        function _getMinSize(sizes) {
          return sizes.reduce((min, size) => size.h * size.w < min.h * min.w ? size : min);
        }
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 7 other locations - About 1 hr to fix
        modules/33acrossBidAdapter.js on lines 570..572
        modules/brightcomBidAdapter.js on lines 214..216
        modules/brightcomSSPBidAdapter.js on lines 240..242
        modules/marsmediaBidAdapter.js on lines 354..356
        modules/medianetBidAdapter.js on lines 293..295
        modules/omsBidAdapter.js on lines 265..267
        modules/underdogmediaBidAdapter.js on lines 217..219

        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

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

        function _getAdMarkup(bid) {
          let adm = bid.adm;
          if ('nurl' in bid) {
            adm += createTrackPixelHtml(bid.nurl);
          }
        Severity: Major
        Found in modules/onomagicBidAdapter.js and 3 other locations - About 40 mins to fix
        modules/brightcomBidAdapter.js on lines 188..194
        modules/brightcomSSPBidAdapter.js on lines 216..222
        modules/omsBidAdapter.js on lines 232..238

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

        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