prebid/Prebid.js

View on GitHub
integrationExamples/videoModule/eventsUI/eventsUI.js

Summary

Maintainability
D
2 days
Test Coverage

Function stringifyReplacer has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

function stringifyReplacer(parentValue) {
  const references = [];
  const safeResults = [];
  let complexity = 0;
  return function stringifyKeyValue(key, value) {
Severity: Minor
Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 6 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 stringifyReplacer has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function stringifyReplacer(parentValue) {
  const references = [];
  const safeResults = [];
  let complexity = 0;
  return function stringifyKeyValue(key, value) {
Severity: Minor
Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 1 hr to fix

    Function stringifyKeyValue has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      return function stringifyKeyValue(key, value) {
        if (typeof value === 'object') {
          if (value === null || value instanceof Date || value instanceof RegExp) {
            return value;
          }
    Severity: Minor
    Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 1 hr to fix

      Function getGenericEventHandler has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getGenericEventHandler() {
        const logContainer = document.querySelector('#eventsLog');
        let currentEventGroup = '';
        let currentEventType = '';
        let lastEvent = '';
      Severity: Minor
      Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 1 hr to fix

        Function genericEventHandler has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          const genericEventHandler = function(e, type, eventGroup) {
            currentEventGroup = eventGroup;
            currentEventType = type;
        
            let group = eventLogGroups[eventGroup];
        Severity: Minor
        Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 1 hr to fix

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

          function incrementEvent(group, currentEventType, currentEventGroup, div, datum) {
          Severity: Minor
          Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 35 mins to fix

            Function getGenericEventHandler has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function getGenericEventHandler() {
              const logContainer = document.querySelector('#eventsLog');
              let currentEventGroup = '';
              let currentEventType = '';
              let lastEvent = '';
            Severity: Minor
            Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 35 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 too many return statements within this function.
            Open

                  return value;
            Severity: Major
            Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  return value;
              Severity: Major
              Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                          return safe;
                Severity: Major
                Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return '<complexity exceeded>';
                  Severity: Major
                  Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return (safeResults[referenceIndex] = '<' + value + '...(see console)>');
                    Severity: Major
                    Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return `${value}`;
                      Severity: Major
                      Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 30 mins to fix

                        Function appendEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function appendEvent(container, currentEventType, currentEventGroup, data) {
                          const div = document.createElement('div');
                          div.classList.add('group-' + currentEventGroup, 'event-' + currentEventType, 'pre');
                          div.textContent = textContentGrouped(currentEventType);
                          div.setAttribute('title', `${currentEventGroup} event "${currentEventType}"`);
                        Severity: Minor
                        Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 25 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

                        Function incrementEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function incrementEvent(group, currentEventType, currentEventGroup, div, datum) {
                          group[currentEventType]++;
                          div.textContent = textContentGrouped(currentEventType, group);
                          const logPreviousEvents = div.onclick;
                          const scopedDatum = Object.assign({}, datum);
                        Severity: Minor
                        Found in integrationExamples/videoModule/eventsUI/eventsUI.js - About 25 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

                        There are no issues that match your filters.

                        Category
                        Status