prebid/Prebid.js

View on GitHub

Showing 3,230 of 5,407 total issues

Function newConfig has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
Open

export function newConfig() {
  let listeners = [];
  let defaults;
  let config;
  let bidderConfig;
Severity: Minor
Found in src/config.js - About 1 day 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 detectReferer has a Cognitive Complexity of 98 (exceeds 5 allowed). Consider refactoring.
Open

export function detectReferer(win) {
  /**
   * This function would return a read-only array of hostnames for all the parent frames.
   * win.location.ancestorOrigins is only supported in webkit browsers. For non-webkit browsers it will return undefined.
   *
Severity: Minor
Found in src/refererDetection.js - About 1 day 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 medianetAnalyticsAdapter.js has 814 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  _map,
  deepAccess,
  getWindowTop,
  groupBy,
Severity: Major
Found in modules/medianetAnalyticsAdapter.js - About 1 day to fix

    Function MarsmediaAdapter has 360 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function MarsmediaAdapter() {
      this.code = 'marsmedia';
      this.aliases = ['mars'];
      this.supportedMediaTypes = [VIDEO, BANNER];
    
    
    Severity: Major
    Found in modules/marsmediaBidAdapter.js - About 1 day to fix

      Function newConfig has 357 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function newConfig() {
        let listeners = [];
        let defaults;
        let config;
        let bidderConfig;
      Severity: Major
      Found in src/config.js - About 1 day to fix

        Function newStorageManager has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
        Open

        export function newStorageManager({moduleName, moduleType} = {}, {isAllowed = isActivityAllowed} = {}) {
          function isValid(cb, storageType) {
            let mod = moduleName;
            const curBidder = config.getCurrentBidder();
            if (curBidder && moduleType === MODULE_TYPE_BIDDER && adapterManager.aliasRegistry[curBidder] === moduleName) {
        Severity: Minor
        Found in src/storageManager.js - About 1 day 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 VideojsProvider has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
        Open

        export function VideojsProvider(providerConfig, vjs_, adState_, timeState_, callbackStorage_, utils) {
          let vjs = vjs_;
          // Supplied callbacks are typically wrapped by handlers
          // we use this dict to keep track of these pairings
          const callbackToHandler = {};
        Severity: Minor
        Found in modules/videojsVideoProvider.js - About 1 day 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 track has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
        Open

          track({ eventType, args }) {
            if (typeof args !== 'undefined') {
              switch (eventType) {
                case EVENTS.AUCTION_INIT:
                  logInfo(localStoragePrefix + 'AUCTION_INIT:', JSON.stringify(args));
        Severity: Minor
        Found in modules/yuktamediaAnalyticsAdapter.js - About 1 day 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 index.js has 715 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * This module adds User ID support to prebid.js
         * @module modules/userId
         */
        
        
        Severity: Major
        Found in modules/userId/index.js - About 1 day to fix

          File mgidBidAdapter.js has 710 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
            _each,
            deepAccess,
            isPlainObject,
            isArray,
          Severity: Major
          Found in modules/mgidBidAdapter.js - About 1 day to fix

            File criteoBidAdapter.js has 702 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { deepAccess, generateUUID, isArray, logError, logInfo, logWarn, parseUrl } from '../src/utils.js';
            import { loadExternalScript } from '../src/adloader.js';
            import { registerBidder } from '../src/adapters/bidderFactory.js';
            import { config } from '../src/config.js';
            import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
            Severity: Major
            Found in modules/criteoBidAdapter.js - About 1 day to fix

              File jwplayerVideoProvider.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                PROTOCOLS, API_FRAMEWORKS, VIDEO_MIME_TYPE, PLAYBACK_METHODS, PLACEMENT, VPAID_MIME_TYPE, AD_POSITION
              } from '../libraries/video/constants/ortb.js';
              import {
                SETUP_COMPLETE, SETUP_FAILED, DESTROYED, AD_REQUEST, AD_BREAK_START, AD_LOADED, AD_STARTED, AD_IMPRESSION, AD_PLAY,
              Severity: Major
              Found in modules/jwplayerVideoProvider.js - About 1 day to fix

                File uid2IdSystem_shared.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                /* eslint-disable no-console */
                import { ajax } from '../src/ajax.js';
                import { cyrb53Hash } from '../src/utils.js';
                
                export const Uid2CodeVersion = '1.1';
                Severity: Major
                Found in modules/uid2IdSystem_shared.js - About 1 day to fix

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

                    buildRequests: function(bidRequests, bidderRequest) {
                      // TODO: does the fallback make sense here?
                      const referer = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
                      const isPageSecure = !!referer.match(/^https:/);
                  
                  
                  Severity: Minor
                  Found in modules/spotxBidAdapter.js - About 1 day 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 utils.js has 687 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {config} from './config.js';
                  import clone from 'just-clone';
                  import {includes} from './polyfill.js';
                  import { EVENTS, S2S } from './constants.js';
                  import {GreedyPromise} from './utils/promise.js';
                  Severity: Major
                  Found in src/utils.js - About 1 day to fix

                    Function RhythmOneBidAdapter has a Cognitive Complexity of 78 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function RhythmOneBidAdapter() {
                      this.code = 'rhythmone';
                      this.supportedMediaTypes = [VIDEO, BANNER];
                      this.gvlid = 36;
                    
                    
                    Severity: Minor
                    Found in modules/rhythmoneBidAdapter.js - About 1 day 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 auction.js has 681 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    /**
                     * Module for auction instances.
                     *
                     * In Prebid 0.x, $$PREBID_GLOBAL$$ had _bidsRequested and _bidsReceived as public properties.
                     * Starting 1.0, Prebid will support concurrent auctions. Each auction instance will store private properties, bidsRequested and bidsReceived.
                    Severity: Major
                    Found in src/auction.js - About 1 day to fix

                      File invibesBidAdapter.js has 676 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import {logInfo} from '../src/utils.js';
                      import {registerBidder} from '../src/adapters/bidderFactory.js';
                      import {getStorageManager} from '../src/storageManager.js';
                      
                      /**
                      Severity: Major
                      Found in modules/invibesBidAdapter.js - About 1 day to fix

                        File newspassidBidAdapter.js has 675 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import {
                          logInfo,
                          logError,
                          deepAccess,
                          logWarn,
                        Severity: Major
                        Found in modules/newspassidBidAdapter.js - About 1 day to fix

                          Function getSyncData has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
                          Open

                          function getSyncData(xml, options) {
                            let ret = [];
                            if (xml) {
                              let ext = xml.getElementsByTagName('Extensions');
                              if (ext && ext.length > 0) {
                          Severity: Minor
                          Found in modules/aniviewBidAdapter.js - About 1 day 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

                          Severity
                          Category
                          Status
                          Source
                          Language