prebid/Prebid.js

View on GitHub
modules/theAdxBidAdapter.js

Summary

Maintainability
F
3 days
Test Coverage

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

  interpretResponse: (serverResponse, request) => {
    logInfo('theadx.interpretResponse', 'serverResponse', serverResponse, ' request', request);

    let responses = [];

Severity: Minor
Found in modules/theAdxBidAdapter.js - About 7 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

File theAdxBidAdapter.js has 456 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { logInfo, isEmpty, deepAccess, parseUrl, getDNT, parseSizesInput, _map } from '../src/utils.js';
import {
  BANNER,
  NATIVE,
  VIDEO
Severity: Minor
Found in modules/theAdxBidAdapter.js - About 6 hrs to fix

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

      interpretResponse: (serverResponse, request) => {
        logInfo('theadx.interpretResponse', 'serverResponse', serverResponse, ' request', request);
    
        let responses = [];
    
    
    Severity: Major
    Found in modules/theAdxBidAdapter.js - About 3 hrs to fix

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

      let buildDeviceComponent = (bidRequest, bidderRequest) => {
        let device = {
          js: 1,
          language: ('language' in navigator) ? navigator.language : null,
          ua: ('userAgent' in navigator) ? navigator.userAgent : null,
      Severity: Minor
      Found in modules/theAdxBidAdapter.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 generateImpBody has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      let generateImpBody = (bidRequest, bidderRequest) => {
        let mediaTypes = bidRequest.mediaTypes;
      
        let banner = null;
        let video = null;
      Severity: Minor
      Found in modules/theAdxBidAdapter.js - About 1 hr to fix

        Function buildRequests has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          buildRequests: function (validBidRequests, bidderRequest) {
            // convert Native ORTB definition to old-style prebid native definition
            validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
        
            logInfo('theadx.buildRequests', 'validBidRequests', validBidRequests, 'bidderRequest', bidderRequest);
        Severity: Minor
        Found in modules/theAdxBidAdapter.js - About 1 hr to fix

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

            getUserSyncs: function (syncOptions, serverResponses) {
              logInfo('theadx.getUserSyncs', 'syncOptions', syncOptions, 'serverResponses', serverResponses)
              const syncs = [];
          
              if (!syncOptions.iframeEnabled && !syncOptions.pixelEnabled) {
          Severity: Minor
          Found in modules/theAdxBidAdapter.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                        if (native.clickTrackers) {
                          native.clickTrackers.unshift(bid.ext.cliu);
                        }
            Severity: Major
            Found in modules/theAdxBidAdapter.js - About 45 mins to fix

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

              let extractValidSize = (bidRequest, bidderRequest) => {
                let width = null;
                let height = null;
              
                let requestedSizes = [];
              Severity: Minor
              Found in modules/theAdxBidAdapter.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 generateImpBody has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              let generateImpBody = (bidRequest, bidderRequest) => {
                let mediaTypes = bidRequest.mediaTypes;
              
                let banner = null;
                let video = null;
              Severity: Minor
              Found in modules/theAdxBidAdapter.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 buildSiteComponent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              let buildSiteComponent = (bidRequest, bidderRequest) => {
                let loc = parseUrl(bidderRequest.refererInfo.page || '', {
                  decodeSearchAsString: true
                });
              
              
              Severity: Minor
              Found in modules/theAdxBidAdapter.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 getEids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              function getEids(bidRequest) {
                let eids = {}
              
                let uId2 = deepAccess(bidRequest, 'userId.uid2.id');
                if (uId2) {
              Severity: Minor
              Found in modules/theAdxBidAdapter.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

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                    if (syncOptions.pixelEnabled && syncImageUrls) {
                      syncImageUrls.forEach(syncImageUrl => {
                        syncs.push({
                          type: 'image',
                          url: syncImageUrl
              Severity: Major
              Found in modules/theAdxBidAdapter.js and 3 other locations - About 55 mins to fix
              modules/microadBidAdapter.js on lines 184..191
              modules/microadBidAdapter.js on lines 192..199
              modules/theAdxBidAdapter.js on lines 309..316

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 54.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 4 locations. Consider refactoring.
              Open

                    if (syncOptions.iframeEnabled && syncIframeUrls) {
                      syncIframeUrls.forEach(syncIframeUrl => {
                        syncs.push({
                          type: 'iframe',
                          url: syncIframeUrl
              Severity: Major
              Found in modules/theAdxBidAdapter.js and 3 other locations - About 55 mins to fix
              modules/microadBidAdapter.js on lines 184..191
              modules/microadBidAdapter.js on lines 192..199
              modules/theAdxBidAdapter.js on lines 317..324

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 54.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              let generateVideoComponent = (bidRequest, bidderRequest) => {
                let impSize = extractValidSize(bidRequest);
              
                return {
                  w: impSize.w,
              Severity: Minor
              Found in modules/theAdxBidAdapter.js and 1 other location - About 35 mins to fix
              modules/theAdxBidAdapter.js on lines 432..439

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              let generateBannerComponent = (bidRequest, bidderRequest) => {
                let impSize = extractValidSize(bidRequest);
              
                return {
                  w: impSize.w,
              Severity: Minor
              Found in modules/theAdxBidAdapter.js and 1 other location - About 35 mins to fix
              modules/theAdxBidAdapter.js on lines 423..430

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 47.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status