prebid/Prebid.js

View on GitHub
modules/ucfunnelBidAdapter.js

Summary

Maintainability
D
2 days
Test Coverage

File ucfunnelBidAdapter.js has 330 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { generateUUID, _each, deepAccess } from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, VIDEO, NATIVE} from '../src/mediaTypes.js';
import { getStorageManager } from '../src/storageManager.js';
import { config } from '../src/config.js';
Severity: Minor
Found in modules/ucfunnelBidAdapter.js - About 3 hrs to fix

    Function getSupplyChain has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    function getSupplyChain(schain) {
      var supplyChain = '';
      if (schain != null && schain.nodes) {
        supplyChain = schain.ver + ',' + schain.complete;
        for (let i = 0; i < schain.nodes.length; i++) {
    Severity: Minor
    Found in modules/ucfunnelBidAdapter.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 getRequestData has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    function getRequestData(bid, bidderRequest) {
      const size = parseSizes(bid);
      const language = navigator.language;
      const dnt = (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0;
      const userIdTdid = (bid.userId && bid.userId.tdid) ? bid.userId.tdid : '';
    Severity: Minor
    Found in modules/ucfunnelBidAdapter.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 getRequestData has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getRequestData(bid, bidderRequest) {
      const size = parseSizes(bid);
      const language = navigator.language;
      const dnt = (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0;
      const userIdTdid = (bid.userId && bid.userId.tdid) ? bid.userId.tdid : '';
    Severity: Major
    Found in modules/ucfunnelBidAdapter.js - About 2 hrs to fix

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

        interpretResponse: function (ucfunnelResponseObj, request) {
          const bidRequest = request.bidRequest;
          const ad = ucfunnelResponseObj ? ucfunnelResponseObj.body : {};
      
          let bid = {
      Severity: Major
      Found in modules/ucfunnelBidAdapter.js - About 2 hrs to fix

        Function addUserId has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function addUserId(bidData, userId) {
          bidData['eids'] = '';
          _each(userId, (userIdObjectOrValue, userIdProviderKey) => {
            switch (userIdProviderKey) {
              case 'hadronId':
        Severity: Minor
        Found in modules/ucfunnelBidAdapter.js - About 1 hr to fix

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

            interpretResponse: function (ucfunnelResponseObj, request) {
              const bidRequest = request.bidRequest;
              const ad = ucfunnelResponseObj ? ucfunnelResponseObj.body : {};
          
              let bid = {
          Severity: Minor
          Found in modules/ucfunnelBidAdapter.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 isBidRequestValid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            isBidRequestValid: function(bid) {
              const isVideoMediaType = (bid.mediaTypes && bid.mediaTypes.video != null);
              const videoContext = (bid.mediaTypes && bid.mediaTypes.video != null) ? bid.mediaTypes.video.videoContext : '';
          
              if (typeof bid.params !== 'object' || typeof bid.params.adid != 'string') {
          Severity: Minor
          Found in modules/ucfunnelBidAdapter.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 getFloor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          function getFloor(bid, size, mediaTypes) {
            if (bid.params.bidfloor) {
              return bid.params.bidfloor;
            }
            if (typeof bid.getFloor === 'function') {
          Severity: Minor
          Found in modules/ucfunnelBidAdapter.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 getUserSyncs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            getUserSyncs: function(syncOptions, serverResponses, gdprConsent = {}, uspConsent) {
              let gdprApplies = (gdprConsent && gdprConsent.gdprApplies) ? '1' : '';
              let apiVersion = (gdprConsent) ? gdprConsent.apiVersion : '';
              let consentString = (gdprConsent) ? gdprConsent.consentString : '';
              if (syncOptions.iframeEnabled) {
          Severity: Minor
          Found in modules/ucfunnelBidAdapter.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