prebid/Prebid.js

View on GitHub
modules/prebidServerBidAdapter/ortbConverter.js

Summary

Maintainability
B
7 hrs
Test Coverage

Function buildPBSRequest has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function buildPBSRequest(s2sBidRequest, bidderRequests, adUnits, requestedBidders) {
  const requestTimestamp = timestamp();
  const impIds = new Set();
  const proxyBidRequests = [];
  const s2sParams = s2sActivityParams(s2sBidRequest.s2sConfig);
Severity: Major
Found in modules/prebidServerBidAdapter/ortbConverter.js - About 2 hrs to fix

    File ortbConverter.js has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {ortbConverter} from '../../libraries/ortbConverter/converter.js';
    import {deepAccess, deepSetValue, getBidRequest, logError, logWarn, mergeDeep, timestamp} from '../../src/utils.js';
    import {config} from '../../src/config.js';
    import {S2S, STATUS} from '../../src/constants.js';
    import {createBid} from '../../src/bidfactory.js';
    Severity: Minor
    Found in modules/prebidServerBidAdapter/ortbConverter.js - About 2 hrs to fix

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

        bidResponse(buildBidResponse, bid, context) {
          // before sending the response throgh "stock" ortb conversion, here we need to:
          // - filter out ones that come from an "unknown" bidder (if allowUnknownBidderCode is not set)
          // - overwrite context.bidRequest with the actual bid request for this seat / imp combination
      
      
      Severity: Minor
      Found in modules/prebidServerBidAdapter/ortbConverter.js - About 1 hr to fix

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

              bidfloor(orig, imp, proxyBidRequest, context) {
                // for bid floors, we pass each bidRequest associated with this imp through normal bidfloor processing,
                // and aggregate all of them into a single, minimum floor to put in the request
                const getMin = minimum(currencyCompare(floor => [floor.bidfloor, floor.bidfloorcur]));
                let min;
        Severity: Minor
        Found in modules/prebidServerBidAdapter/ortbConverter.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 request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          request(buildRequest, imps, proxyBidderRequest, context) {
            if (!imps.length) {
              logError('Request to Prebid Server rejected due to invalid media type(s) in adUnit.');
            } else {
              let {s2sBidRequest} = context;
        Severity: Minor
        Found in modules/prebidServerBidAdapter/ortbConverter.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 fpd has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              fpd(orig, ortbRequest, proxyBidderRequest, context) {
                // FPD is handled different for PBS - the base request will only contain global FPD;
                // bidder-specific values are set in ext.prebid.bidderconfig
        
                if (context.transmitTids) {
        Severity: Minor
        Found in modules/prebidServerBidAdapter/ortbConverter.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

        There are no issues that match your filters.

        Category
        Status