prebid/Prebid.js

View on GitHub

Showing 5,479 of 5,479 total issues

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

function interpretResponse(serverResponse, request) {
  if (!serverResponse || !serverResponse.body) {
    return [];
  }
  const {bidId} = request.data;
Severity: Major
Found in modules/minutemediaplusBidAdapter.js and 4 other locations - About 2 days to fix
modules/illuminBidAdapter.js on lines 183..249
modules/kueezRtbBidAdapter.js on lines 186..252
modules/shinezRtbBidAdapter.js on lines 182..248
modules/tagorasBidAdapter.js on lines 182..248

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

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 5 locations. Consider refactoring.
Open

function interpretResponse(serverResponse, request) {
  if (!serverResponse || !serverResponse.body) {
    return [];
  }
  const {bidId} = request.data;
Severity: Major
Found in modules/tagorasBidAdapter.js and 4 other locations - About 2 days to fix
modules/illuminBidAdapter.js on lines 183..249
modules/kueezRtbBidAdapter.js on lines 186..252
modules/minutemediaplusBidAdapter.js on lines 187..253
modules/shinezRtbBidAdapter.js on lines 182..248

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

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 5 locations. Consider refactoring.
Open

function interpretResponse(serverResponse, request) {
  if (!serverResponse || !serverResponse.body) {
    return [];
  }
  const {bidId} = request.data;
Severity: Major
Found in modules/illuminBidAdapter.js and 4 other locations - About 2 days to fix
modules/kueezRtbBidAdapter.js on lines 186..252
modules/minutemediaplusBidAdapter.js on lines 187..253
modules/shinezRtbBidAdapter.js on lines 182..248
modules/tagorasBidAdapter.js on lines 182..248

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

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

const createNativeRequest = br => {
  let impObject = {
    ver: '1.2',
    assets: []
  };
Severity: Major
Found in modules/videoheroesBidAdapter.js and 1 other location - About 2 days to fix
modules/braveBidAdapter.js on lines 196..225

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

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

const createNativeRequest = br => {
  let impObject = {
    ver: '1.2',
    assets: []
  };
Severity: Major
Found in modules/braveBidAdapter.js and 1 other location - About 2 days to fix
modules/videoheroesBidAdapter.js on lines 194..223

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

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 JWPlayerProvider has 413 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function JWPlayerProvider(config, jwplayer_, adState_, timeState_, callbackStorage_, utils, sharedUtils) {
  const jwplayer = jwplayer_;
  let player = null;
  let playerVersion = null;
  const playerConfig = config.playerConfig;
Severity: Major
Found in modules/jwplayerVideoProvider.js - About 2 days to fix

    Function VideojsProvider has 404 lines of code (exceeds 25 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: Major
    Found in modules/videojsVideoProvider.js - About 2 days to fix

      File pubwiseBidAdapter.js has 836 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      
      import { _each, isBoolean, isEmptyStr, isNumber, isStr, deepClone, isArray, deepSetValue, inIframe, mergeDeep, deepAccess, logMessage, logInfo, logWarn, logError } 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';
      Severity: Major
      Found in modules/pubwiseBidAdapter.js - About 2 days to fix

        Function newTargeting has 401 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function newTargeting(auctionManager) {
          let targeting = {};
          let latestAuctionForAdUnit = {};
        
          targeting.setLatestAuctionForAdUnit = function(adUnitCode, auctionId) {
        Severity: Major
        Found in src/targeting.js - About 2 days to fix

          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

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

          function interpretResponse(serverResponse) {
            if (!serverResponse.body || typeof serverResponse.body != 'object') {
              logWarn('Onomagic server returned empty/non-json response: ' + JSON.stringify(serverResponse.body));
              return [];
            }
          Severity: Major
          Found in modules/onomagicBidAdapter.js and 1 other location - About 1 day to fix
          modules/brightcomBidAdapter.js on lines 134..169

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

          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

          function interpretResponse(serverResponse) {
            if (!serverResponse.body || typeof serverResponse.body != 'object') {
              logWarn('Brightcom server returned empty/non-json response: ' + JSON.stringify(serverResponse.body));
              return [];
            }
          Severity: Major
          Found in modules/brightcomBidAdapter.js and 1 other location - About 1 day to fix
          modules/onomagicBidAdapter.js on lines 107..142

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

          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

            getUserSyncs: function (syncOptions, serverResponse, gdprConsent, uspConsent, gppConsent) {
              const origin = encodeURIComponent(location.origin || `https://${location.host}`);
              let syncParamUrl = `dm=${origin}`;
          
              if (gdprConsent && gdprConsent.consentString) {
          Severity: Major
          Found in modules/mediagoBidAdapter.js and 1 other location - About 1 day to fix
          modules/discoveryBidAdapter.js on lines 669..706

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

          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

            getUserSyncs: function (syncOptions, serverResponse, gdprConsent, uspConsent, gppConsent) {
              const origin = encodeURIComponent(location.origin || `https://${location.host}`);
              let syncParamUrl = `dm=${origin}`;
          
              if (gdprConsent && gdprConsent.consentString) {
          Severity: Major
          Found in modules/discoveryBidAdapter.js and 1 other location - About 1 day to fix
          modules/mediagoBidAdapter.js on lines 555..592

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

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

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

                    matchItem: function (string, data) {
                      var i = 0;
                      var j = 0;
                      var regex, regexv, match, matches, version;
            
            
            Severity: Major
            Found in modules/adWMGBidAdapter.js and 1 other location - About 1 day to fix
            modules/adWMGAnalyticsAdapter.js on lines 234..273

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

            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

                matchItem: function (string, data) {
                  var i = 0;
                  var j = 0;
                  var regex, regexv, match, matches, version;
            
            
            Severity: Major
            Found in modules/adWMGAnalyticsAdapter.js and 1 other location - About 1 day to fix
            modules/adWMGBidAdapter.js on lines 264..303

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

            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

            function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '', gppConsent = {}) {
              let syncs = [];
              const {iframeEnabled, pixelEnabled} = syncOptions;
              const {gdprApplies, consentString = ''} = gdprConsent;
              const {gppString, applicableSections} = gppConsent;
            Severity: Major
            Found in modules/vidazooBidAdapter.js and 1 other location - About 1 day to fix
            modules/twistDigitalBidAdapter.js on lines 341..368

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

            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

            function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '', gppConsent = {}) {
              let syncs = [];
              const {iframeEnabled, pixelEnabled} = syncOptions;
              const {gdprApplies, consentString = ''} = gdprConsent;
              const {gppString, applicableSections} = gppConsent;
            Severity: Major
            Found in modules/twistDigitalBidAdapter.js and 1 other location - About 1 day to fix
            modules/vidazooBidAdapter.js on lines 350..377

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

            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

            Severity
            Category
            Status
            Source
            Language