prebid/Prebid.js

View on GitHub
modules/pubwiseAnalyticsAdapter.js

Summary

Maintainability
C
1 day
Test Coverage

File pubwiseAnalyticsAdapter.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { getParameterByName, logInfo, generateUUID, debugTurnedOn } from '../src/utils.js';
import {ajax} from '../src/ajax.js';
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import { EVENTS } from '../src/constants.js';
Severity: Minor
Found in modules/pubwiseAnalyticsAdapter.js - About 2 hrs to fix

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

    function enrichWithUTM(dataBag) {
      let newUtm = false;
      try {
        for (let prop in utmKeys) {
          utmKeys[prop] = getParameterByName(prop);
    Severity: Minor
    Found in modules/pubwiseAnalyticsAdapter.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 enrichWithCustomSegments has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    function enrichWithCustomSegments(dataBag) {
      // c_script_type: '', c_slot1: '', c_slot2: '', c_slot3: '', c_slot4: ''
      if (configOptions.custom) {
        if (configOptions.custom.c_script_type) {
          dataBag['c_script_type'] = configOptions.custom.c_script_type;
    Severity: Minor
    Found in modules/pubwiseAnalyticsAdapter.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 filterAuctionInit has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function filterAuctionInit(data) {
      let modified = Object.assign({}, data);
    
      modified.refererInfo = {};
      // handle clean referrer, we only need one
    Severity: Minor
    Found in modules/pubwiseAnalyticsAdapter.js - About 1 hr to fix

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

      function enrichWithUTM(dataBag) {
        let newUtm = false;
        try {
          for (let prop in utmKeys) {
            utmKeys[prop] = getParameterByName(prop);
      Severity: Minor
      Found in modules/pubwiseAnalyticsAdapter.js - About 1 hr to fix

        Function handleEvent has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        pubwiseAnalytics.handleEvent = function(eventType, data) {
          // we log most events, but some are information
          if (isIngestedEvent(eventType)) {
            pwInfo(`Emitting Event ${eventType} ${pwAnalyticsEnabled}`, data);
        
        
        Severity: Minor
        Found in modules/pubwiseAnalyticsAdapter.js - About 55 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 filterAuctionInit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function filterAuctionInit(data) {
          let modified = Object.assign({}, data);
        
          modified.refererInfo = {};
          // handle clean referrer, we only need one
        Severity: Minor
        Found in modules/pubwiseAnalyticsAdapter.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 filterBidResponse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function filterBidResponse(data) {
          let modified = Object.assign({}, data);
          // clean up some properties we don't track in public version
          if (typeof modified.ad !== 'undefined') {
            modified.ad = '';
        Severity: Minor
        Found in modules/pubwiseAnalyticsAdapter.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