Showing 145 of 325 total issues
Function toSessionContextEntity
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
toSessionContextEntity(): MediaSessionStats {
return {
timePaused: this.pausedDuration > 0 ? this.round(this.pausedDuration) : undefined,
timePlayed: this.playbackDuration > 0 ? this.round(this.playbackDuration) : undefined,
timePlayedMuted: this.playbackDurationMuted > 0 ? this.round(this.playbackDurationMuted) : undefined,
- 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 createCrossDomainParameterValue
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function createCrossDomainParameterValue(
isExtendedFormat: boolean,
attributeConfiguration: ExtendedCrossDomainLinkerAttributes | undefined,
attributeValues: ExtendedCrossDomainLinkerValues & {
/* As `reason` might be a callback, we also need to pass the event to calculate the reason value. */
- 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 updateAdStats
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private updateAdStats(log: Log) {
// only works with ad event types
if (log.eventType === undefined) {
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"
Further reading
Function validateVendorParts
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export function validateVendorParts(parts: Array<string>): boolean {
if (parts[0] === '*' || parts[1] === '*') {
return false; // no wildcard in first or second part
}
if (parts.slice(2).length > 0) {
- 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 syncNpmrc
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function syncNpmrc(options) {
const { sourceNpmrcFolder, targetNpmrcFolder, useNpmrcPublish, logger = {
// eslint-disable-next-line no-console
info: console.log,
// eslint-disable-next-line no-console
Function updateDurationStats
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private updateDurationStats(log: Log) {
// if ad was playing until now and it was a linear ad, don't add the duration stats
let wasPlayingAd = this.lastAdUpdateAt !== undefined;
const shouldCountStats = (!wasPlayingAd || !log.linearAd) ?? true;
if (!shouldCountStats) {
Function buildHTMLMediaElementEntity
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function buildHTMLMediaElementEntity(el: HTMLAudioElement | HTMLVideoElement): SelfDescribingJson {
const data: MediaElement = {
// htmlId is a required property in the schema, but may not be present if
// the user provided the element themselves
htmlId: el.id || '',
Function clearUserDataAndCookies
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function clearUserDataAndCookies(configuration?: ClearUserDataConfiguration) {
const idname = getSnowplowCookieName('id');
const sesname = getSnowplowCookieName('ses');
attemptDeleteLocalStorage(idname);
attemptDeleteLocalStorage(sesname);
Function decorateQuerystring
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function decorateQuerystring(url: string, name: string, value: string) {
var initialQsParams = name + '=' + value;
var hashSplit = url.split('#');
var qsSplit = hashSplit[0].split('?');
var beforeQuerystring = qsSplit.shift();
- 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 matchSchemaAgainstRule
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function matchSchemaAgainstRule(rule: string, schema: string): boolean {
if (!isValidRule(rule)) return false;
const ruleParts = getRuleParts(rule);
const schemaParts = getSchemaParts(schema);
if (ruleParts && schemaParts) {
- 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 eventHandler
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function eventHandler(event: MouseEvent, trackerId: string, filter: FilterFunction, context?: DynamicContext) {
let elem = (event.composed ? event.composedPath()[0] : event.target) as HTMLElement | null;
while (elem) {
if (elem instanceof HTMLButtonElement || (elem instanceof HTMLInputElement && elem.type === 'button')) {
if (filter(elem)) {
- 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 constructor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
constructor(configuration?: FilterOutRepeatedEvents) {
let allFiltersEnabled = configuration === undefined || configuration === true;
if (allFiltersEnabled || (typeof configuration === 'object' && configuration.seekEvents !== false)) {
this.aggregateEventsWithOrder[getMediaEventSchema(MediaEventType.SeekStart)] = true;
this.aggregateEventsWithOrder[getMediaEventSchema(MediaEventType.SeekEnd)] = false;
- 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 initializeResizeObserver
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function initializeResizeObserver() {
if (resizeObserverInitialized) {
return;
}
if(!document || !document.body || !document.documentElement) {
- 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 findMediaElementChild
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function findMediaElementChild(el: Element): SearchResult {
for (let tag of ['VIDEO', 'AUDIO']) {
let descendentTags = el.getElementsByTagName(tag);
if (descendentTags.length === 1) {
const el = descendentTags[0];
- 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 newLocalStorageEventStore
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function newLocalStorageEventStore({
trackerId,
maxLocalStorageQueueSize = 1000,
useLocalStorage = true,
}: LocalStorageEventStoreConfiguration): LocalStorageEventStore {
- 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 update
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
update(
trackEvent: (event: EventWithContext) => void,
mediaEvent?: MediaEvent,
customEvent?: SelfDescribingJson,
player?: MediaPlayerUpdate,
- 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 cookie
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
name: string,
value?: string,
ttl?: number,
path?: string,
domain?: string,
Function setCookie
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
name: string,
value?: string,
ttl?: number,
path?: string,
domain?: string,
Function installAndRun
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
Function evaluateProvider
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function evaluateProvider(
provider: ConditionalContextProvider,
event: PayloadBuilder,
eventType: string,
eventSchema: string
- 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"