prebid/Prebid.js

View on GitHub
modules/jwplayerRtdProvider.js

Summary

Maintainability
C
1 day
Test Coverage

File jwplayerRtdProvider.js has 352 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This module adds the jwplayer provider to the Real Time Data module (rtdModule)
 * The {@link module:modules/realTimeData} module is required
 * The module will allow Ad Bidders to obtain JW Player's Video Ad Targeting information
 * The module will fetch segments for the media ids present in the prebid config when the module loads. If any bid
Severity: Minor
Found in modules/jwplayerRtdProvider.js - About 4 hrs to fix

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

    export function addOrtbSiteContent(ortb2, contentId, contentData, contentTitle, contentDescription, contentUrl) {
      if (ortb2 == null) {
        ortb2 = {};
      }
    
    
    Severity: Minor
    Found in modules/jwplayerRtdProvider.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 addOrtbSiteContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function addOrtbSiteContent(ortb2, contentId, contentData, contentTitle, contentDescription, contentUrl) {
      if (ortb2 == null) {
        ortb2 = {};
      }
    
    
    Severity: Minor
    Found in modules/jwplayerRtdProvider.js - About 1 hr to fix

      Function addOrtbSiteContent has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      export function addOrtbSiteContent(ortb2, contentId, contentData, contentTitle, contentDescription, contentUrl) {
      Severity: Minor
      Found in modules/jwplayerRtdProvider.js - About 45 mins to fix

        Avoid too many return statements within this function.
        Open

            return player;
        Severity: Major
        Found in modules/jwplayerRtdProvider.js - About 30 mins to fix

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

          export function getPlayer(playerDivId) {
            const jwplayer = window.jwplayer;
            if (!jwplayer) {
              logError(SUBMODULE_NAME + '.js was not found on page');
              return;
          Severity: Minor
          Found in modules/jwplayerRtdProvider.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