prebid/Prebid.js

View on GitHub
modules/r2b2BidAdapter.js

Summary

Maintainability
B
5 hrs
Test Coverage

File r2b2BidAdapter.js has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {logWarn, logError, triggerPixel, deepSetValue, getParameterByName} from '../src/utils.js';
import {ortbConverter} from '../libraries/ortbConverter/converter.js'
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {Renderer} from '../src/Renderer.js';
import {BANNER, VIDEO, NATIVE} from '../src/mediaTypes.js';
Severity: Minor
Found in modules/r2b2BidAdapter.js - About 2 hrs to fix

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

    function createPrebidResponseBid(requestImp, bidResponse, serverResponse, bids) {
      const bidId = requestImp.id;
      const adUnitCode = bids[0].adUnitCode;
      const mediaType = bidResponse.ext.prebid.type;
      let bidOut = {
    Severity: Minor
    Found in modules/r2b2BidAdapter.js - About 1 hr to fix

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

      function setUpRenderer(adUnitCode, bid) {
        // let renderer load once in main window, but pass the renderDocument
        let renderDoc;
        const config = {
          documentResolver: (bid, sourceDocument, renderDocument) => {
      Severity: Minor
      Found in modules/r2b2BidAdapter.js - About 1 hr to fix

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

        function getIdParamsFromPID(pid) {
          // selfpromo test creative
          if (pid === R2B2_TEST_UNIT) {
            return { d: 'test', g: 'test', p: 'selfpromo', m: 0, selfpromo: 1 }
          }
        Severity: Minor
        Found in modules/r2b2BidAdapter.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