prebid/Prebid.js

View on GitHub
modules/pixfutureBidAdapter.js

Summary

Maintainability
F
5 days
Test Coverage

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

  buildRequests(validBidRequests, bidderRequest) {
    const tags = validBidRequests.map(bidToTag);
    const hostname = this.getHostname();
    return validBidRequests.map((bidRequest) => {
      if (bidRequest.params.pix_id) {
Severity: Major
Found in modules/pixfutureBidAdapter.js - About 3 hrs to fix

    File pixfutureBidAdapter.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {registerBidder} from '../src/adapters/bidderFactory.js';
    import {getStorageManager} from '../src/storageManager.js';
    import {BANNER} from '../src/mediaTypes.js';
    import {config} from '../src/config.js';
    import {find, includes} from '../src/polyfill.js';
    Severity: Minor
    Found in modules/pixfutureBidAdapter.js - About 3 hrs to fix

      Function bidToTag has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
      Open

      function bidToTag(bid) {
        const tag = {};
        tag.sizes = transformSizes(bid.sizes);
        tag.primary_size = tag.sizes[0];
        tag.ad_types = [];
      Severity: Minor
      Found in modules/pixfutureBidAdapter.js - About 3 hrs 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 bidToTag has 66 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function bidToTag(bid) {
        const tag = {};
        tag.sizes = transformSizes(bid.sizes);
        tag.primary_size = tag.sizes[0];
        tag.ad_types = [];
      Severity: Major
      Found in modules/pixfutureBidAdapter.js - About 2 hrs to fix

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

          getUserSyncs: function (syncOptions, bid, gdprConsent, uspConsent) {
            const syncs = [];
        
            let syncurl = 'pixid=' + pixID;
            let gdpr = (gdprConsent && gdprConsent.gdprApplies) ? 1 : 0;
        Severity: Minor
        Found in modules/pixfutureBidAdapter.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

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

              if (userObjBid) {
                Object.keys(userObjBid.params.user)
                  .filter(param => includes(USER_PARAMS, param))
                  .forEach((param) => {
                    let uparam = convertCamelToUnderscore(param);
        Severity: Major
        Found in modules/pixfutureBidAdapter.js and 3 other locations - About 1 day to fix
        modules/appnexusBidAdapter.js on lines 156..175
        modules/goldbachBidAdapter.js on lines 139..158
        modules/mediafuseBidAdapter.js on lines 126..145

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

        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 (bid.params.position) {
            tag.position = {'above': 1, 'below': 2}[bid.params.position] || 0;
          } else {
            let mediaTypePos = deepAccess(bid, `mediaTypes.banner.pos`) || deepAccess(bid, `mediaTypes.video.pos`);
            // only support unknown, atf, and btf values for position at this time
        Severity: Major
        Found in modules/pixfutureBidAdapter.js and 2 other locations - About 5 hrs to fix
        modules/adrelevantisBidAdapter.js on lines 441..450
        modules/appnexusBidAdapter.js on lines 798..807

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

        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.reserve) ? bid.params.reserve : null;
          }
        
        
        Severity: Major
        Found in modules/pixfutureBidAdapter.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/onomagicBidAdapter.js on lines 260..274
        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

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

              if (bidderRequest && bidderRequest.refererInfo) {
                let refererinfo = {
                  // TODO: this collects everything it finds, except for canonicalUrl
                  rd_ref: encodeURIComponent(bidderRequest.refererInfo.topmostLocation),
                  rd_top: bidderRequest.refererInfo.reachedTop,
        Severity: Major
        Found in modules/pixfutureBidAdapter.js and 4 other locations - About 4 hrs to fix
        modules/adrelevantisBidAdapter.js on lines 137..146
        modules/goldbachBidAdapter.js on lines 253..262
        modules/mediafuseBidAdapter.js on lines 254..263
        modules/winrBidAdapter.js on lines 233..244

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

        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 addUserId(eids, id, source, rti) {
          if (id) {
            if (rti) {
              eids.push({source, id, rti_partner: rti});
            } else {
        Severity: Major
        Found in modules/pixfutureBidAdapter.js and 3 other locations - About 2 hrs to fix
        modules/goldbachBidAdapter.js on lines 1106..1115
        modules/mediafuseBidAdapter.js on lines 1094..1103
        modules/winrBidAdapter.js on lines 566..575

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

        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

              if (bidderRequest && bidderRequest.gdprConsent) {
                ret.data.gdprConsent = {
                  consentString: bidderRequest.gdprConsent.consentString,
                  consentRequired: (typeof bidderRequest.gdprConsent.gdprApplies === 'boolean') && bidderRequest.gdprConsent.gdprApplies
                };
        Severity: Major
        Found in modules/pixfutureBidAdapter.js and 1 other location - About 2 hrs to fix
        modules/orbidderBidAdapter.js on lines 110..115

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

        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

          if (bid.params.placementId) {
            tag.id = parseInt(bid.params.placementId, 10);
          } else {
            tag.code = bid.params.invCode;
          }
        Severity: Major
        Found in modules/pixfutureBidAdapter.js and 3 other locations - About 1 hr to fix
        modules/goldbachBidAdapter.js on lines 732..736
        modules/mediafuseBidAdapter.js on lines 719..723
        modules/winrBidAdapter.js on lines 463..467

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

        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

          getHostname() {
            let ret = this.hostname;
            try {
              ret = storageManager.getDataFromLocalStorage('ov_pixbidder_host') || ret;
            } catch (e) {
        Severity: Minor
        Found in modules/pixfutureBidAdapter.js and 1 other location - About 50 mins to fix
        modules/orbidderBidAdapter.js on lines 57..64

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

        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

            return !!(bid.sizes && bid.bidId && bid.params &&
                        (bid.params.pix_id && (typeof bid.params.pix_id === 'string')));
        Severity: Minor
        Found in modules/pixfutureBidAdapter.js and 1 other location - About 50 mins to fix
        modules/orbidderBidAdapter.js on lines 73..74

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

        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 (rtbBid.adomain) {
            bid.meta = Object.assign({}, bid.meta, { advertiserDomains: [rtbBid.adomain] });
          };
        Severity: Minor
        Found in modules/pixfutureBidAdapter.js and 1 other location - About 40 mins to fix
        modules/appnexusBidAdapter.js on lines 611..613

        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