modules/jwplayerRtdProvider.js
File jwplayerRtdProvider.js
has 352 lines of code (exceeds 250 allowed). Consider refactoring. Open
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
Function addOrtbSiteContent
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
export function addOrtbSiteContent(ortb2, contentId, contentData, contentTitle, contentDescription, contentUrl) {
if (ortb2 == null) {
ortb2 = {};
}
- Read upRead up
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
Open
export function addOrtbSiteContent(ortb2, contentId, contentData, contentTitle, contentDescription, contentUrl) {
if (ortb2 == null) {
ortb2 = {};
}
Function addOrtbSiteContent
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
export function addOrtbSiteContent(ortb2, contentId, contentData, contentTitle, contentDescription, contentUrl) {
Avoid too many return
statements within this function. Open
Open
return player;
Function getPlayer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
export function getPlayer(playerDivId) {
const jwplayer = window.jwplayer;
if (!jwplayer) {
logError(SUBMODULE_NAME + '.js was not found on page');
return;
- Read upRead up
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"