prebid/Prebid.js

View on GitHub
modules/nativoBidAdapter.js

Summary

Maintainability
D
2 days
Test Coverage

File nativoBidAdapter.js has 493 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { deepAccess, isEmpty } from '../src/utils.js'
import { registerBidder } from '../src/adapters/bidderFactory.js'
import { BANNER } from '../src/mediaTypes.js'
import { getGlobal } from '../src/prebidGlobal.js'
import { ortbConverter } from '../libraries/ortbConverter/converter.js'
Severity: Minor
Found in modules/nativoBidAdapter.js - About 7 hrs to fix

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

      buildRequests: function (validBidRequests, bidderRequest) {
        // Get OpenRTB Data
        const openRTBData = converter.toORTB({bidRequests: validBidRequests, bidderRequest})
        const openRTBDataString = JSON.stringify(openRTBData)
    
    
    Severity: Major
    Found in modules/nativoBidAdapter.js - About 4 hrs to fix

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

        getUserSyncs: function (
          syncOptions,
          serverResponses,
          gdprConsent,
          uspConsent
      Severity: Major
      Found in modules/nativoBidAdapter.js - About 2 hrs to fix

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

          interpretResponse: function (response, request) {
            // If the bid response was empty, return []
            if (!response || !response.body || isEmpty(response.body)) return []
        
            try {
        Severity: Minor
        Found in modules/nativoBidAdapter.js - About 1 hr to fix

          Function parseFloorPriceData has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function parseFloorPriceData(bidRequest) {
            if (typeof bidRequest.getFloor !== 'function') return
          
            // Setup price floor data per bid request
            let bidRequestFloorPriceData = {}
          Severity: Minor
          Found in modules/nativoBidAdapter.js - About 1 hr to fix

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

            export function BidDataMap() {
              const referenceMap = {}
              const bids = []
            
              /**
            Severity: Minor
            Found in modules/nativoBidAdapter.js - About 1 hr to fix

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

                buildRequests: function (validBidRequests, bidderRequest) {
                  // Get OpenRTB Data
                  const openRTBData = converter.toORTB({bidRequests: validBidRequests, bidderRequest})
                  const openRTBDataString = JSON.stringify(openRTBData)
              
              
              Severity: Minor
              Found in modules/nativoBidAdapter.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 BidDataMap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              export function BidDataMap() {
                const referenceMap = {}
                const bids = []
              
                /**
              Severity: Minor
              Found in modules/nativoBidAdapter.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