prebid/Prebid.js

View on GitHub

Showing 3,230 of 5,407 total issues

File sspBCBidAdapter.js has 665 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { deepAccess, getWindowTop, isArray, logWarn } from '../src/utils.js';
import { ajax } from '../src/ajax.js';
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
Severity: Major
Found in modules/sspBCBidAdapter.js - About 1 day to fix

    File adbookpspBidAdapter.js has 664 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {find, includes} from '../src/polyfill.js';
    import {config} from '../src/config.js';
    import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
    import {getStorageManager} from '../src/storageManager.js';
    import {
    Severity: Major
    Found in modules/adbookpspBidAdapter.js - About 1 day to fix

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

        buildRequests: function(validBidRequests, bidderRequest) {
          if (!validBidRequests.length) {
            return null;
          }
          let pageKeywords = null;
      Severity: Major
      Found in modules/gridBidAdapter.js - About 1 day to fix

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

          buildRequests(validBidRequests, bidderRequest) {
            // convert Native ORTB definition to old-style prebid native definition
            validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
        
            const secure = (location.protocol === 'https:') ? 1 : 0;
        Severity: Minor
        Found in modules/adagioBidAdapter.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 videojsVideoProvider.js has 643 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          SETUP_COMPLETE, SETUP_FAILED, DESTROYED,
          PLAYLIST, PLAYBACK_REQUEST, CONTENT_LOADED, PLAY, PAUSE, TIME, SEEK_START, SEEK_END, MUTE, VOLUME, ERROR, COMPLETE,
          FULLSCREEN, PLAYER_RESIZE,
          AD_REQUEST, AD_IMPRESSION, AD_TIME, AD_COMPLETE, AD_SKIPPED, AD_CLICK, AD_STARTED, AD_ERROR, AD_LOADED, AD_PLAY, AD_PAUSE
        Severity: Major
        Found in modules/videojsVideoProvider.js - About 1 day to fix

          File native.js has 638 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import {
            deepAccess,
            deepClone, getDefinedParams,
            insertHtmlIntoIframe,
            isArray,
          Severity: Major
          Found in src/native.js - About 1 day to fix

            File pubmaticAnalyticsAdapter.js has 636 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {_each, isArray, isStr, logError, logWarn, pick, generateUUID} from '../src/utils.js';
            import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
            import adapterManager from '../src/adapterManager.js';
            import { BID_STATUS, EVENTS, STATUS, REJECTION_REASON } from '../src/constants.js';
            import {ajax} from '../src/ajax.js';
            Severity: Major
            Found in modules/pubmaticAnalyticsAdapter.js - About 1 day to fix

              File 33acrossBidAdapter.js has 631 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {registerBidder} from '../src/adapters/bidderFactory.js';
              import {config} from '../src/config.js';
              import {
                deepAccess,
                getWindowSelf,
              Severity: Major
              Found in modules/33acrossBidAdapter.js - About 1 day to fix

                File gridBidAdapter.js has 623 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import {
                  isEmpty,
                  deepAccess,
                  logError,
                  parseGPTSingleSizeArrayToRtbSize,
                Severity: Major
                Found in modules/gridBidAdapter.js - About 1 day to fix

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

                    buildRequests(validBidRequests, bidderRequest) {
                      this.loadConfiguredData(validBidRequests[0]);
                      this.propertyBag.buildRequestsStart = new Date().getTime();
                      logInfo(`buildRequests time: ${this.propertyBag.buildRequestsStart} v ${NEWSPASSVERSION} validBidRequests`, JSON.parse(JSON.stringify(validBidRequests)), 'bidderRequest', JSON.parse(JSON.stringify(bidderRequest)));
                      if (this.blockTheRequest()) {
                  Severity: Minor
                  Found in modules/newspassidBidAdapter.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 buildRequests has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
                  Open

                    buildRequests: function(bidRequests, bidderRequest) {
                      // var currency = config.getConfig(currency);
                  
                      let buildRequest = (currentBidRequest, bidderRequest) => {
                        var zone = currentBidRequest.params.zoneId;
                  Severity: Minor
                  Found in modules/freewheel-sspBidAdapter.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 operaadsBidAdapter.js has 603 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {
                    deepAccess,
                    deepSetValue,
                    generateUUID,
                    getDNT,
                  Severity: Major
                  Found in modules/operaadsBidAdapter.js - About 1 day to fix

                    File yahoosspBidAdapter.js has 602 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { registerBidder } from '../src/adapters/bidderFactory.js';
                    import { BANNER, VIDEO } from '../src/mediaTypes.js';
                    import { deepAccess, isFn, isStr, isNumber, isArray, isEmpty, isPlainObject, generateUUID, logInfo, logWarn } from '../src/utils.js';
                    import { config } from '../src/config.js';
                    import { Renderer } from '../src/Renderer.js';
                    Severity: Major
                    Found in modules/yahoosspBidAdapter.js - About 1 day to fix

                      Function toOrtbNativeRequest has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
                      Open

                      export function toOrtbNativeRequest(legacyNativeAssets) {
                        if (!legacyNativeAssets && !isPlainObject(legacyNativeAssets)) {
                          logWarn(`${LOG_WARN_PREFIX}: Native assets object is empty or not an object: ${legacyNativeAssets}`);
                          isInvalidNativeRequest = true;
                          return;
                      Severity: Minor
                      Found in modules/pubmaticBidAdapter.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 priceFloors.js has 593 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import {
                        debugTurnedOn,
                        deepAccess,
                        deepClone,
                        deepSetValue,
                      Severity: Major
                      Found in modules/priceFloors.js - About 1 day to fix

                        File prebid.js has 591 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /** @module pbjs */
                        
                        import {getGlobal} from './prebidGlobal.js';
                        import {
                          deepAccess,
                        Severity: Major
                        Found in src/prebid.js - About 1 day to fix

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

                            buildRequests(validBidRequests, bidderRequest) {
                              this.loadWhitelabelData(validBidRequests[0]);
                              this.propertyBag.buildRequestsStart = new Date().getTime();
                              let whitelabelBidder = this.propertyBag.whitelabel.bidder; // by default = ozone
                              let whitelabelPrefix = this.propertyBag.whitelabel.keyPrefix;
                          Severity: Major
                          Found in modules/ozoneBidAdapter.js - About 1 day to fix

                            File adtrueBidAdapter.js has 580 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { logWarn, isArray, inIframe, isNumber, isStr, deepClone, deepSetValue, logError, deepAccess, isBoolean } from '../src/utils.js';
                            import {registerBidder} from '../src/adapters/bidderFactory.js';
                            import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
                            import {config} from '../src/config.js';
                            import {getStorageManager} from '../src/storageManager.js';
                            Severity: Major
                            Found in modules/adtrueBidAdapter.js - About 1 day to fix

                              Function buildOneRequest has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function buildOneRequest(validBidRequests, bidderRequest) {
                                let hostInfo = _getHostInfo(validBidRequests);
                                const ENDPOINT = hostInfo.endpoint;
                                hostDomain = hostInfo.domain;
                              
                              
                              Severity: Minor
                              Found in modules/tappxBidAdapter.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 storageTool has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const storageTool = (function () {
                                const storage = getStorageManager({ bidderCode: BIDDER_CODE });
                                let metaInternal;
                              
                                const getMetaDataFromLocalStorage = function (pNetwork) {
                              Severity: Minor
                              Found in modules/adnuntiusBidAdapter.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