prebid/Prebid.js

View on GitHub
modules/tagorasBidAdapter.js

Summary

Maintainability
F
1 wk
Test Coverage

Function buildRequest has 86 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
  const {
    params,
    bidId,
    userId,
Severity: Major
Found in modules/tagorasBidAdapter.js - About 3 hrs to fix

    File tagorasBidAdapter.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import {_each, deepAccess, parseSizesInput, parseUrl, uniques, isFn} from '../src/utils.js';
    import {registerBidder} from '../src/adapters/bidderFactory.js';
    import {BANNER, VIDEO} from '../src/mediaTypes.js';
    import {getStorageManager} from '../src/storageManager.js';
    import {config} from '../src/config.js';
    Severity: Minor
    Found in modules/tagorasBidAdapter.js - About 3 hrs to fix

      Function interpretResponse has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function interpretResponse(serverResponse, request) {
        if (!serverResponse || !serverResponse.body) {
          return [];
        }
        const {bidId} = request.data;
      Severity: Major
      Found in modules/tagorasBidAdapter.js - About 2 hrs to fix

        Function buildRequest has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

        function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
          const {
            params,
            bidId,
            userId,
        Severity: Minor
        Found in modules/tagorasBidAdapter.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 getUserSyncs has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '', gppConsent = {}) {
        Severity: Minor
        Found in modules/tagorasBidAdapter.js - About 35 mins to fix

          Function buildRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
          Severity: Minor
          Found in modules/tagorasBidAdapter.js - About 35 mins to fix

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

            function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
              const {
                params,
                bidId,
                userId,
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 2 other locations - About 4 days to fix
            modules/illuminBidAdapter.js on lines 46..145
            modules/shinezRtbBidAdapter.js on lines 45..144

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

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

            export function getUniqueDealId(key, expiry = UNIQUE_DEAL_ID_EXPIRY) {
              const storageKey = `u_${key}`;
              const now = Date.now();
              const data = getStorageItem(storageKey);
              let uniqueId;
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 6 other locations - About 5 hrs to fix
            modules/illuminBidAdapter.js on lines 285..299
            modules/kueezRtbBidAdapter.js on lines 295..309
            modules/minutemediaplusBidAdapter.js on lines 296..310
            modules/shinezRtbBidAdapter.js on lines 284..298
            modules/twistDigitalBidAdapter.js on lines 409..423
            modules/vidazooBidAdapter.js on lines 437..451

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

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

            function appendUserIdsToRequestPayload(payloadRef, userIds) {
              let key;
              _each(userIds, (userId, idSystemProviderName) => {
                key = `uid.${idSystemProviderName}`;
            
            
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 6 other locations - About 5 hrs to fix
            modules/illuminBidAdapter.js on lines 147..169
            modules/kueezRtbBidAdapter.js on lines 150..172
            modules/minutemediaplusBidAdapter.js on lines 151..173
            modules/shinezRtbBidAdapter.js on lines 146..168
            modules/twistDigitalBidAdapter.js on lines 207..228
            modules/vidazooBidAdapter.js on lines 215..236

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

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

            function buildRequests(validBidRequests, bidderRequest) {
              const topWindowUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
              const bidderTimeout = config.getConfig('bidderTimeout');
              const requests = [];
              validBidRequests.forEach(validBidRequest => {
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 3 other locations - About 4 hrs to fix
            modules/illuminBidAdapter.js on lines 171..181
            modules/minutemediaplusBidAdapter.js on lines 175..185
            modules/shinezRtbBidAdapter.js on lines 170..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 121.

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

            export function hashCode(s, prefix = '_') {
              const l = s.length;
              let h = 0
              let i = 0;
              if (l > 0) {
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 6 other locations - About 3 hrs to fix
            modules/illuminBidAdapter.js on lines 273..283
            modules/kueezRtbBidAdapter.js on lines 283..293
            modules/minutemediaplusBidAdapter.js on lines 284..294
            modules/shinezRtbBidAdapter.js on lines 272..282
            modules/twistDigitalBidAdapter.js on lines 397..407
            modules/vidazooBidAdapter.js on lines 406..416

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

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

            export function setStorageItem(key, value, timestamp) {
              try {
                const created = timestamp || Date.now();
                const data = JSON.stringify({value, created});
                storage.setDataInLocalStorage(key, data);
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 6 other locations - About 2 hrs to fix
            modules/illuminBidAdapter.js on lines 310..317
            modules/kueezRtbBidAdapter.js on lines 320..327
            modules/minutemediaplusBidAdapter.js on lines 321..328
            modules/shinezRtbBidAdapter.js on lines 309..316
            modules/twistDigitalBidAdapter.js on lines 434..441
            modules/vidazooBidAdapter.js on lines 476..483

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

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

            export function extractPID(params) {
              return params.pId || params.PID || params.pID || params.PId || params.pid || params.piD || params.Pid || params.PiD;
            }
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 11 other locations - About 2 hrs to fix
            modules/kueezRtbBidAdapter.js on lines 29..31
            modules/kueezRtbBidAdapter.js on lines 33..35
            modules/minutemediaplusBidAdapter.js on lines 30..32
            modules/minutemediaplusBidAdapter.js on lines 34..36
            modules/shinezRtbBidAdapter.js on lines 28..30
            modules/shinezRtbBidAdapter.js on lines 32..34
            modules/tagorasBidAdapter.js on lines 28..30
            modules/twistDigitalBidAdapter.js on lines 43..45
            modules/twistDigitalBidAdapter.js on lines 47..49
            modules/vidazooBidAdapter.js on lines 45..47
            modules/vidazooBidAdapter.js on lines 49..51

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

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

            export function extractCID(params) {
              return params.cId || params.CID || params.cID || params.CId || params.cid || params.ciD || params.Cid || params.CiD;
            }
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 11 other locations - About 2 hrs to fix
            modules/kueezRtbBidAdapter.js on lines 29..31
            modules/kueezRtbBidAdapter.js on lines 33..35
            modules/minutemediaplusBidAdapter.js on lines 30..32
            modules/minutemediaplusBidAdapter.js on lines 34..36
            modules/shinezRtbBidAdapter.js on lines 28..30
            modules/shinezRtbBidAdapter.js on lines 32..34
            modules/tagorasBidAdapter.js on lines 32..34
            modules/twistDigitalBidAdapter.js on lines 43..45
            modules/twistDigitalBidAdapter.js on lines 47..49
            modules/vidazooBidAdapter.js on lines 45..47
            modules/vidazooBidAdapter.js on lines 49..51

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

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

            function getTopWindowQueryParams() {
              try {
                const parsedUrl = parseUrl(window.top.document.URL, {decodeSearchAsString: true});
                return parsedUrl.search;
              } catch (e) {
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 6 other locations - About 1 hr to fix
            modules/illuminBidAdapter.js on lines 16..23
            modules/kueezRtbBidAdapter.js on lines 16..23
            modules/minutemediaplusBidAdapter.js on lines 17..24
            modules/shinezRtbBidAdapter.js on lines 15..22
            modules/twistDigitalBidAdapter.js on lines 30..37
            modules/vidazooBidAdapter.js on lines 32..39

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

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

            export function extractSubDomain(params) {
              return params.subDomain || params.SubDomain || params.Subdomain || params.subdomain || params.SUBDOMAIN || params.subDOMAIN;
            }
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 5 other locations - About 1 hr to fix
            modules/kueezRtbBidAdapter.js on lines 37..39
            modules/minutemediaplusBidAdapter.js on lines 38..40
            modules/shinezRtbBidAdapter.js on lines 36..38
            modules/twistDigitalBidAdapter.js on lines 51..53
            modules/vidazooBidAdapter.js on lines 53..55

            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

            export const spec = {
              code: BIDDER_CODE,
              version: BIDDER_VERSION,
              supportedMediaTypes: [BANNER, VIDEO],
              isBidRequestValid,
            Severity: Major
            Found in modules/tagorasBidAdapter.js and 2 other locations - About 40 mins to fix
            modules/onetagBidAdapter.js on lines 436..445
            modules/shinezRtbBidAdapter.js on lines 326..334

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

            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