prebid/Prebid.js

View on GitHub

Showing 4,877 of 4,877 total issues

Function setMockCategories has 1249 lines of code (exceeds 25 allowed). Consider refactoring.
Open

prebidTestUtils.setMockCategories = function () {
  const key = 'iabToFwMappingkey';
  const keyPub = 'iabToFwMappingkeyPub';
  const keyBidder = 'appnexus';
  const currTime = new Date().getTime();
Severity: Major
Found in integrationExamples/longform/longformTestUtils.js - About 6 days to fix

    File ixBidAdapter.js has 1472 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {
      contains,
      deepAccess,
      deepClone,
      deepSetValue,
    Severity: Major
    Found in modules/ixBidAdapter.js - About 3 days to fix

      Function createRtdProvider has a Cognitive Complexity of 180 (exceeds 5 allowed). Consider refactoring.
      Open

      export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
        const MODULE_NAME = 'realTimeData';
        const SUBMODULE_NAME = moduleName;
        const MODULE_CODE = moduleCode;
      
      
      Severity: Minor
      Found in modules/symitriDapRtdProvider.js - About 3 days 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 longformTestUtils.js has 1313 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      var prebidTestUtils = prebidTestUtils || {};
      
      function getIndustry(id) {
        var mapping = window.localStorage.getItem('iabToFwMappingkey');
        if (mapping) {
      Severity: Major
      Found in integrationExamples/longform/longformTestUtils.js - About 3 days to fix

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

          getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
            const syncs = [];
        
            if (!syncOptions.iframeEnabled && !syncOptions.pixelEnabled) {
              return syncs;
        Severity: Major
        Found in modules/adpartnerBidAdapter.js and 1 other location - About 3 days to fix
        modules/mediaimpactBidAdapter.js on lines 149..212

        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 559.

        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

          getUserSyncs: function(syncOptions, serverResponses, gdprConsent, uspConsent) {
            const syncs = [];
        
            if (!syncOptions.iframeEnabled && !syncOptions.pixelEnabled) {
              return syncs;
        Severity: Major
        Found in modules/mediaimpactBidAdapter.js and 1 other location - About 3 days to fix
        modules/adpartnerBidAdapter.js on lines 144..207

        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 559.

        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

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

              if (mediaTypes && mediaTypes.video) {
                if (!hasFavoredMediaType || params.favoredMediaType === VIDEO) {
                  const playerSize = mediaTypes.video.playerSize || sizes;
                  const videoImp = Object.assign({}, imp, {
                    video: {
        Severity: Major
        Found in modules/cleanmedianetBidAdapter.js and 1 other location - About 3 days to fix
        modules/gamoshiBidAdapter.js on lines 146..180

        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 537.

        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

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

              if (mediaTypes && mediaTypes.video) {
                if (!hasFavoredMediaType || params.favoredMediaType === VIDEO) {
                  const playerSize = mediaTypes.video.playerSize || sizes;
                  const videoImp = Object.assign({}, imp, {
                    video: {
        Severity: Major
        Found in modules/gamoshiBidAdapter.js and 1 other location - About 3 days to fix
        modules/cleanmedianetBidAdapter.js on lines 146..180

        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 537.

        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

        File pubmaticBidAdapter.js has 1209 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { getBidRequest, logWarn, isBoolean, isStr, isArray, inIframe, mergeDeep, deepAccess, isNumber, deepSetValue, logInfo, logError, deepClone, uniques, isPlainObject, isInteger, generateUUID } from '../src/utils.js';
        import { registerBidder } from '../src/adapters/bidderFactory.js';
        import { BANNER, VIDEO, NATIVE, ADPOD } from '../src/mediaTypes.js';
        import { config } from '../src/config.js';
        import { Renderer } from '../src/Renderer.js';
        Severity: Major
        Found in modules/pubmaticBidAdapter.js - About 3 days to fix

          Function createRtdProvider has 608 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function createRtdProvider(moduleName, moduleCode, headerPrefix) {
            const MODULE_NAME = 'realTimeData';
            const SUBMODULE_NAME = moduleName;
            const MODULE_CODE = moduleCode;
          
          
          Severity: Major
          Found in modules/symitriDapRtdProvider.js - About 3 days to fix

            File appnexusBidAdapter.js has 1155 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              createTrackPixelHtml,
              deepAccess,
              deepClone,
              getBidRequest,
            Severity: Major
            Found in modules/appnexusBidAdapter.js - About 2 days to fix

              Function nobidBuildRequests has a Cognitive Complexity of 144 (exceeds 5 allowed). Consider refactoring.
              Open

              function nobidBuildRequests(bids, bidderRequest) {
                var serializeState = function(divIds, siteId, adunits) {
                  var filterAdUnitsByIds = function(divIds, adUnits) {
                    var filtered = [];
                    if (!divIds.length) {
              Severity: Minor
              Found in modules/nobidBidAdapter.js - About 2 days 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

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

              export const spec = {
                code: BIDDER_CODE,
                supportedMediaTypes: [BANNER],
                /**
                 * Determines whether or not the given bid request is valid.
              Severity: Major
              Found in modules/invamiaBidAdapter.js and 1 other location - About 2 days to fix
              modules/biddoBidAdapter.js on lines 12..95

              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 493.

              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

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

              export const spec = {
                code: BIDDER_CODE,
                supportedMediaTypes: [BANNER],
                /**
                 * Determines whether or not the given bid request is valid.
              Severity: Major
              Found in modules/biddoBidAdapter.js and 1 other location - About 2 days to fix
              modules/invamiaBidAdapter.js on lines 12..95

              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 493.

              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

              export const utiqMtpIdSubmodule = {
                /**
                 * Used to link submodule with config
                 * @type {string}
                 */
              Severity: Major
              Found in modules/utiqMtpIdSystem.js and 1 other location - About 2 days to fix
              modules/utiqIdSystem.js on lines 61..138

              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 491.

              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

              export const utiqIdSubmodule = {
                /**
                 * Used to link submodule with config
                 * @type {string}
                 */
              Severity: Major
              Found in modules/utiqIdSystem.js and 1 other location - About 2 days to fix
              modules/utiqMtpIdSystem.js on lines 59..136

              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 491.

              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

              File ozoneBidAdapter.js has 1109 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import {
                logInfo,
                logError,
                deepAccess,
                logWarn,
              Severity: Major
              Found in modules/ozoneBidAdapter.js - About 2 days to fix

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

                  getUserSyncs: function (syncOptions, serverResponses, gdprConsent, uspConsent) {
                    const syncs = [];
                    let gdprApplies = false;
                    let consentString = '';
                    let uspConsentString = '';
                Severity: Major
                Found in modules/cleanmedianetBidAdapter.js and 1 other location - About 2 days to fix
                modules/gamoshiBidAdapter.js on lines 250..305

                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 477.

                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

                  getUserSyncs: function (syncOptions, serverResponses, gdprConsent, uspConsent) {
                    const syncs = [];
                    let gdprApplies = false;
                    let consentString = '';
                    let uspConsentString = '';
                Severity: Major
                Found in modules/gamoshiBidAdapter.js and 1 other location - About 2 days to fix
                modules/cleanmedianetBidAdapter.js on lines 250..305

                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 477.

                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

                Function MarsmediaAdapter has a Cognitive Complexity of 131 (exceeds 5 allowed). Consider refactoring.
                Open

                function MarsmediaAdapter() {
                  this.code = 'marsmedia';
                  this.aliases = ['mars'];
                  this.supportedMediaTypes = [VIDEO, BANNER];
                
                
                Severity: Minor
                Found in modules/marsmediaBidAdapter.js - About 2 days 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