prebid/Prebid.js

View on GitHub
src/adapterManager.js

Summary

Maintainability
F
3 days
Test Coverage

File adapterManager.js has 588 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** @module adaptermanger */

import {
  deepAccess,
  deepClone,
Severity: Major
Found in src/adapterManager.js - About 1 day to fix

    Function makeBidRequests has 106 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}, auctionMetrics) {
      auctionMetrics = useMetrics(auctionMetrics);
      /**
       * emit and pass adunits for external modification
       * @see {@link https://github.com/prebid/Prebid.js/issues/4149|Issue}
    Severity: Major
    Found in src/adapterManager.js - About 4 hrs to fix

      Function callBids has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, requestCallbacks, requestBidsTimeout, onTimelyResponse, ortb2Fragments = {}) => {
        if (!bidRequests.length) {
          logWarn('callBids executed with no bidRequests.  Were they filtered by labels or sizing?');
          return;
        }
      Severity: Major
      Found in src/adapterManager.js - About 3 hrs to fix

        Function aliasBidAdapter has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

        adapterManager.aliasBidAdapter = function (bidderCode, alias, options) {
          let existingAlias = _bidderRegistry[alias];
        
          if (typeof existingAlias === 'undefined') {
            let bidAdapter = _bidderRegistry[bidderCode];
        Severity: Minor
        Found in src/adapterManager.js - About 2 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 aliasBidAdapter has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        adapterManager.aliasBidAdapter = function (bidderCode, alias, options) {
          let existingAlias = _bidderRegistry[alias];
        
          if (typeof existingAlias === 'undefined') {
            let bidAdapter = _bidderRegistry[bidderCode];
        Severity: Minor
        Found in src/adapterManager.js - About 1 hr to fix

          Function registerBidAdapter has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          adapterManager.registerBidAdapter = function (bidAdapter, bidderCode, {supportedMediaTypes = []} = {}) {
            if (bidAdapter && bidderCode) {
              if (typeof bidAdapter.callBids === 'function') {
                _bidderRegistry[bidderCode] = bidAdapter;
                GDPR_GVLIDS.register(MODULE_TYPE_BIDDER, bidderCode, bidAdapter.getSpec?.().gvlid);
          Severity: Minor
          Found in src/adapterManager.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 makeBidRequests has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}, auctionMetrics) {
          Severity: Major
          Found in src/adapterManager.js - About 50 mins to fix

            Function invokeBidderMethod has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function invokeBidderMethod(bidder, method, spec, fn, ...params) {
            Severity: Minor
            Found in src/adapterManager.js - About 35 mins to fix

              Function registerAnalyticsAdapter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              adapterManager.registerAnalyticsAdapter = function ({adapter, code, gvlid}) {
                if (adapter && code) {
                  if (typeof adapter.enableAnalytics === 'function') {
                    adapter.code = code;
                    _analyticsRegistry[code] = { adapter, gvlid };
              Severity: Minor
              Found in src/adapterManager.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 makeBidRequests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              adapterManager.makeBidRequests = hook('sync', function (adUnits, auctionStart, auctionId, cbTimeout, labels, ortb2Fragments = {}, auctionMetrics) {
                auctionMetrics = useMetrics(auctionMetrics);
                /**
                 * emit and pass adunits for external modification
                 * @see {@link https://github.com/prebid/Prebid.js/issues/4149|Issue}
              Severity: Minor
              Found in src/adapterManager.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