prebid/Prebid.js

View on GitHub
modules/gothamadsBidAdapter.js

Summary

Maintainability
F
5 days
Test Coverage

Function addNativeParameters has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

const addNativeParameters = bidRequest => {
  let impObject = {
    // TODO: this is not an "impObject", and `id` is not part of the ORTB native spec
    id: bidRequest.bidId,
    ver: NATIVE_VERSION,
Severity: Minor
Found in modules/gothamadsBidAdapter.js - About 3 hrs 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 gothamadsBidAdapter.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { logMessage, deepSetValue, deepAccess, _map, logWarn } 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 { convertOrtbRequestToProprietaryNative } from '../src/native.js';
Severity: Minor
Found in modules/gothamadsBidAdapter.js - About 2 hrs to fix

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

      buildRequests: (validBidRequests, bidderRequest) => {
        // convert Native ORTB definition to old-style prebid native definition
        validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
    
        if (validBidRequests && validBidRequests.length === 0) return []
    Severity: Minor
    Found in modules/gothamadsBidAdapter.js - About 2 hrs 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 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      buildRequests: (validBidRequests, bidderRequest) => {
        // convert Native ORTB definition to old-style prebid native definition
        validBidRequests = convertOrtbRequestToProprietaryNative(validBidRequests);
    
        if (validBidRequests && validBidRequests.length === 0) return []
    Severity: Major
    Found in modules/gothamadsBidAdapter.js - About 2 hrs to fix

      Function interpretResponse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        interpretResponse: (serverResponse) => {
          if (!serverResponse || !serverResponse.body) return [];
          let GothamAdsResponse = serverResponse.body;
      
          let bids = [];
      Severity: Minor
      Found in modules/gothamadsBidAdapter.js - About 1 hr 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 interpretResponse has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        interpretResponse: (serverResponse) => {
          if (!serverResponse || !serverResponse.body) return [];
          let GothamAdsResponse = serverResponse.body;
      
          let bids = [];
      Severity: Minor
      Found in modules/gothamadsBidAdapter.js - About 1 hr to fix

        Function addNativeParameters has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const addNativeParameters = bidRequest => {
          let impObject = {
            // TODO: this is not an "impObject", and `id` is not part of the ORTB native spec
            id: bidRequest.bidId,
            ver: NATIVE_VERSION,
        Severity: Minor
        Found in modules/gothamadsBidAdapter.js - About 1 hr to fix

          Function parseSizes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          const parseSizes = (bid, mediaType) => {
            let mediaTypes = bid.mediaTypes;
            if (mediaType === 'video') {
              let size = [];
              if (mediaTypes.video && mediaTypes.video.w && mediaTypes.video.h) {
          Severity: Minor
          Found in modules/gothamadsBidAdapter.js - About 55 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

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

            if (mediaType === 'video') {
              let size = [];
              if (mediaTypes.video && mediaTypes.video.w && mediaTypes.video.h) {
                size = [
                  mediaTypes.video.w,
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 2 other locations - About 1 day to fix
          modules/luponmediaBidAdapter.js on lines 559..572
          modules/rubiconBidAdapter.js on lines 876..889

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

          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

          const parseNative = admObject => {
            const {
              assets,
              link,
              imptrackers,
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 1 other location - About 1 day to fix
          modules/dianomiBidAdapter.js on lines 334..356

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

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

          const NATIVE_PARAMS = {
            title: {
              id: 0,
              name: 'title'
            },
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 3 other locations - About 4 hrs to fix
          modules/adotBidAdapter.js on lines 35..42
          modules/dianomiBidAdapter.js on lines 31..61
          modules/outbrainBidAdapter.js on lines 18..25

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

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

                if (aRatios && aRatios[0]) {
                  aRatios = aRatios[0];
                  wmin = aRatios.min_width || 0;
                  hmin = aRatios.ratio_height * wmin / aRatios.ratio_width | 0;
                }
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 4 other locations - About 1 hr to fix
          modules/dianomiBidAdapter.js on lines 155..159
          modules/outbrainBidAdapter.js on lines 315..319
          modules/revcontentBidAdapter.js on lines 247..251
          modules/seedingAllianceBidAdapter.js on lines 58..62

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

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

              try {
                location = new URL(bidderRequest.refererInfo.page)
                winTop = window.top;
              } catch (e) {
                location = winTop.location;
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 8 other locations - About 1 hr to fix
          modules/admanBidAdapter.js on lines 76..82
          modules/adprimeBidAdapter.js on lines 61..67
          modules/boldwinBidAdapter.js on lines 59..65
          modules/e_volutionBidAdapter.js on lines 76..82
          modules/krushmediaBidAdapter.js on lines 59..65
          modules/lunamediahbBidAdapter.js on lines 43..49
          modules/precisoBidAdapter.js on lines 38..44
          modules/smartyadsBidAdapter.js on lines 78..84

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

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

            for (let param of supportParamsList) {
              if (bidRequest.mediaTypes.video[param] !== undefined) {
                videoObj[param] = bidRequest.mediaTypes.video[param];
              }
            }
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 2 other locations - About 1 hr to fix
          modules/braveBidAdapter.js on lines 242..246
          modules/videoheroesBidAdapter.js on lines 239..243

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

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

                let mediaType = response.seatbid[0].bid[0].ext && response.seatbid[0].bid[0].ext.mediaType ? response.seatbid[0].bid[0].ext.mediaType : BANNER;
          Severity: Major
          Found in modules/gothamadsBidAdapter.js and 2 other locations - About 45 mins to fix
          modules/gammaBidAdapter.js on lines 129..129
          modules/vrtcalBidAdapter.js on lines 135..139

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

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

                if (bidParams.sizes) {
                  const sizes = flatten(bidParams.sizes);
                  wmin = sizes[0];
                  hmin = sizes[1];
                }
          Severity: Minor
          Found in modules/gothamadsBidAdapter.js and 2 other locations - About 40 mins to fix
          modules/dailyhuntBidAdapter.js on lines 201..205
          modules/dianomiBidAdapter.js on lines 161..165

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

          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

          There are no issues that match your filters.

          Category
          Status