prebid/Prebid.js

View on GitHub
modules/tripleliftBidAdapter.js

Summary

Maintainability
D
2 days
Test Coverage

File tripleliftBidAdapter.js has 344 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utils from '../src/utils.js';
import { logMessage, logError, isEmpty, logWarn } from '../src/utils.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
Severity: Minor
Found in modules/tripleliftBidAdapter.js - About 4 hrs to fix

    Function _buildResponseObject has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    function _buildResponseObject(bidderRequest, bid) {
      let bidResponse = {};
      let width = bid.width || 1;
      let height = bid.height || 1;
      let dealId = bid.deal_id || '';
    Severity: Minor
    Found in modules/tripleliftBidAdapter.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 _buildResponseObject has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function _buildResponseObject(bidderRequest, bid) {
      let bidResponse = {};
      let width = bid.width || 1;
      let height = bid.height || 1;
      let dealId = bid.deal_id || '';
    Severity: Minor
    Found in modules/tripleliftBidAdapter.js - About 1 hr to fix

      Function buildRequests has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

        buildRequests: function(bidRequests, bidderRequest) {
          let tlCall = STR_ENDPOINT;
          let data = _buildPostBody(bidRequests, bidderRequest);
      
          tlCall = tryAppendQueryString(tlCall, 'lib', 'prebid');
      Severity: Minor
      Found in modules/tripleliftBidAdapter.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 buildRequests has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        buildRequests: function(bidRequests, bidderRequest) {
          let tlCall = STR_ENDPOINT;
          let data = _buildPostBody(bidRequests, bidderRequest);
      
          tlCall = tryAppendQueryString(tlCall, 'lib', 'prebid');
      Severity: Minor
      Found in modules/tripleliftBidAdapter.js - About 1 hr to fix

        Function _buildPostBody has 41 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function _buildPostBody(bidRequests, bidderRequest) {
          let data = {};
          let { schain } = bidRequests[0];
          const globalFpd = _getGlobalFpd(bidderRequest);
        
        
        Severity: Minor
        Found in modules/tripleliftBidAdapter.js - About 1 hr to fix

          Function _buildPostBody has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function _buildPostBody(bidRequests, bidderRequest) {
            let data = {};
            let { schain } = bidRequests[0];
            const globalFpd = _getGlobalFpd(bidderRequest);
          
          
          Severity: Minor
          Found in modules/tripleliftBidAdapter.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 getUserSyncs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy, gppConsent) {
              let syncType = _getSyncType(syncOptions);
              if (!syncType) return;
          
              let syncEndpoint = 'https://eb2.3lift.com/sync?';
          Severity: Minor
          Found in modules/tripleliftBidAdapter.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 _getGlobalFpd has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function _getGlobalFpd(bidderRequest) {
            const fpd = {};
            const context = {}
            const user = {};
            const ortbData = bidderRequest.ortb2 || {};
          Severity: Minor
          Found in modules/tripleliftBidAdapter.js - About 1 hr to fix

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

              getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy, gppConsent) {
                let syncType = _getSyncType(syncOptions);
                if (!syncType) return;
            
                let syncEndpoint = 'https://eb2.3lift.com/sync?';
            Severity: Minor
            Found in modules/tripleliftBidAdapter.js - About 1 hr to fix

              Function _getFloor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              function _getFloor (bid) {
                let floor = null;
                if (typeof bid.getFloor === 'function') {
                  try {
                    const floorInfo = bid.getFloor({
              Severity: Minor
              Found in modules/tripleliftBidAdapter.js - About 45 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 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                getUserSyncs: function(syncOptions, responses, gdprConsent, usPrivacy, gppConsent) {
              Severity: Minor
              Found in modules/tripleliftBidAdapter.js - About 35 mins to fix

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

                function _getGlobalFpd(bidderRequest) {
                  const fpd = {};
                  const context = {}
                  const user = {};
                  const ortbData = bidderRequest.ortb2 || {};
                Severity: Minor
                Found in modules/tripleliftBidAdapter.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