prebid/Prebid.js

View on GitHub
modules/illuminBidAdapter.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/illuminBidAdapter.js - About 3 hrs to fix

    File illuminBidAdapter.js has 297 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/illuminBidAdapter.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/illuminBidAdapter.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/illuminBidAdapter.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 buildRequest has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
        Severity: Minor
        Found in modules/illuminBidAdapter.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/illuminBidAdapter.js and 2 other locations - About 4 days to fix
          modules/shinezRtbBidAdapter.js on lines 45..144
          modules/tagorasBidAdapter.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/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

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

          function getUserSyncs(syncOptions, responses, gdprConsent = {}, uspConsent = '') {
            let syncs = [];
            const {iframeEnabled, pixelEnabled} = syncOptions;
            const {gdprApplies, consentString = ''} = gdprConsent;
          
          
          Severity: Major
          Found in modules/illuminBidAdapter.js and 1 other location - About 1 day to fix
          modules/shinezRtbBidAdapter.js on lines 250..270

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

          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/illuminBidAdapter.js and 6 other locations - About 5 hrs to fix
          modules/kueezRtbBidAdapter.js on lines 295..309
          modules/minutemediaplusBidAdapter.js on lines 296..310
          modules/shinezRtbBidAdapter.js on lines 284..298
          modules/tagorasBidAdapter.js on lines 290..304
          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/illuminBidAdapter.js and 6 other locations - About 5 hrs to fix
          modules/kueezRtbBidAdapter.js on lines 150..172
          modules/minutemediaplusBidAdapter.js on lines 151..173
          modules/shinezRtbBidAdapter.js on lines 146..168
          modules/tagorasBidAdapter.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/illuminBidAdapter.js and 3 other locations - About 4 hrs to fix
          modules/minutemediaplusBidAdapter.js on lines 175..185
          modules/shinezRtbBidAdapter.js on lines 170..180
          modules/tagorasBidAdapter.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/illuminBidAdapter.js and 6 other locations - About 3 hrs to fix
          modules/kueezRtbBidAdapter.js on lines 283..293
          modules/minutemediaplusBidAdapter.js on lines 284..294
          modules/shinezRtbBidAdapter.js on lines 272..282
          modules/tagorasBidAdapter.js on lines 278..288
          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/illuminBidAdapter.js and 6 other locations - About 2 hrs to fix
          modules/kueezRtbBidAdapter.js on lines 320..327
          modules/minutemediaplusBidAdapter.js on lines 321..328
          modules/shinezRtbBidAdapter.js on lines 309..316
          modules/tagorasBidAdapter.js on lines 315..322
          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

          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/illuminBidAdapter.js and 6 other locations - About 1 hr to fix
          modules/kueezRtbBidAdapter.js on lines 16..23
          modules/minutemediaplusBidAdapter.js on lines 17..24
          modules/shinezRtbBidAdapter.js on lines 15..22
          modules/tagorasBidAdapter.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

          There are no issues that match your filters.

          Category
          Status