prebid/Prebid.js

View on GitHub
modules/aniviewBidAdapter.js

Summary

Maintainability
F
5 days
Test Coverage

Function getSyncData has a Cognitive Complexity of 76 (exceeds 5 allowed). Consider refactoring.
Open

function getSyncData(xml, options) {
  let ret = [];
  if (xml) {
    let ext = xml.getElementsByTagName('Extensions');
    if (ext && ext.length > 0) {
Severity: Minor
Found in modules/aniviewBidAdapter.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 interpretResponse has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

function interpretResponse(serverResponse, bidRequest) {
  let bidResponses = [];
  if (serverResponse && serverResponse.body) {
    if (serverResponse.error) {
      return bidResponses;
Severity: Minor
Found in modules/aniviewBidAdapter.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 buildRequests has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
Open

function buildRequests(validBidRequests, bidderRequest) {
  let bidRequests = [];

  for (let i = 0; i < validBidRequests.length; i++) {
    let bidRequest = validBidRequests[i];
Severity: Minor
Found in modules/aniviewBidAdapter.js - About 7 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 getCpmData has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

function getCpmData(xml) {
  let ret = {cpm: 0, currency: 'USD'};
  if (xml) {
    let ext = xml.getElementsByTagName('Extensions');
    if (ext && ext.length > 0) {
Severity: Minor
Found in modules/aniviewBidAdapter.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

File aniviewBidAdapter.js has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { VIDEO, BANNER } from '../src/mediaTypes.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { Renderer } from '../src/Renderer.js';
import { logError } from '../src/utils.js';

Severity: Minor
Found in modules/aniviewBidAdapter.js - About 2 hrs to fix

    Function buildRequests has 69 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function buildRequests(validBidRequests, bidderRequest) {
      let bidRequests = [];
    
      for (let i = 0; i < validBidRequests.length; i++) {
        let bidRequest = validBidRequests[i];
    Severity: Major
    Found in modules/aniviewBidAdapter.js - About 2 hrs to fix

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

      function interpretResponse(serverResponse, bidRequest) {
        let bidResponses = [];
        if (serverResponse && serverResponse.body) {
          if (serverResponse.error) {
            return bidResponses;
      Severity: Major
      Found in modules/aniviewBidAdapter.js - About 2 hrs to fix

        Function getSyncData has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getSyncData(xml, options) {
          let ret = [];
          if (xml) {
            let ext = xml.getElementsByTagName('Extensions');
            if (ext && ext.length > 0) {
        Severity: Minor
        Found in modules/aniviewBidAdapter.js - About 1 hr to fix

          Function getUserSyncs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function getUserSyncs(syncOptions, serverResponses) {
            if (serverResponses && serverResponses[0] && serverResponses[0].body) {
              if (serverResponses.error) {
                return [];
              } else {
          Severity: Minor
          Found in modules/aniviewBidAdapter.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 newRenderer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

          function newRenderer(bidRequest) {
            let playerDomain = 'player.aniview.com';
            const config = {};
          
            if (bidRequest && bidRequest.bidRequest && bidRequest.bidRequest.params) {
          Severity: Minor
          Found in modules/aniviewBidAdapter.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

          Avoid deeply nested control flow statements.
          Open

                    if (ext[i].getAttribute('type') == 'ANIVIEW') {
                      let price = ext[i].getElementsByTagName('Cpm');
                      if (price && price.length == 1) {
                        ret.cpm = price[0].textContent;
                      }
          Severity: Major
          Found in modules/aniviewBidAdapter.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                        if (cpmData.cpm > 0) {
                          bidResponse.requestId = bidRequest.data.bidId;
                          bidResponse.ad = '';
                          bidResponse.cpm = cpmData.cpm;
                          bidResponse.width = bidRequest.data.AV_WIDTH;
            Severity: Major
            Found in modules/aniviewBidAdapter.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                        if (ext[i].getAttribute('type') == 'ANIVIEW') {
                          let syncs = ext[i].getElementsByTagName('AdServingSync');
                          if (syncs && syncs.length == 1) {
                            try {
                              let data = JSON.parse(syncs[0].textContent);
              Severity: Major
              Found in modules/aniviewBidAdapter.js - About 45 mins to fix

                There are no issues that match your filters.

                Category
                Status