Showing 145 of 325 total issues
Function OptimizelyXPlugin
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function OptimizelyXPlugin(): BrowserPlugin {
/**
* Check that *both* optimizely and optimizely.get exist
*
* @param property - optimizely data property
- 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 addTracker
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
trackerId: string,
namespace: string,
version: string,
endpoint: string,
sharedState: SharedState,
Avoid deeply nested control flow statements. Open
if (!process.env[environmentVariableName]) {
// No, so trim this line
lineShouldBeTrimmed = true;
break;
}
Function setValue
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function setValue(value?: string, ttl?: number, path?: string, domain?: string, samesite?: string, secure?: boolean): boolean {
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor(pingIntervalSeconds: number | undefined, maxPausedPings: number | undefined, trackPing: () => void) {
if (maxPausedPings !== undefined) {
this.maxPausedPings = maxPausedPings;
}
- 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 Tracker
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
trackerId: string,
namespace: string,
version: string,
endpoint: string,
sharedState: SharedState,
Function matchVendor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function matchVendor(rule: string, vendor: string): boolean {
// rule and vendor must have same number of elements
const vendorParts = vendor.split('.');
const ruleParts = rule.split('.');
if (vendorParts && ruleParts) {
- 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 updateBufferingStats
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private updateBufferingStats(log: Log) {
if (log.eventType == MediaEventType.BufferStart) {
this.bufferingStartedAt = log.time;
this.bufferingStartTime = log.contentTime;
} else if (this.bufferingStartedAt !== 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 getUTF8Length
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function getUTF8Length(s: string) {
let len = 0;
for (let i = 0; i < s.length; i++) {
const code = s.charCodeAt(i);
if (code <= 0x7f) {
- 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 deleteCookie
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function deleteCookie(name: string, path?: string, domainName?: string, sameSite?: string, secure?: boolean): void {
Function deleteCookie
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function deleteCookie(cookieName: string, path?: string, domainName?: string, sameSite?: string, secure?: boolean) {
Function _installPackage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function _installPackage(logger, packageInstallFolder, name, version, command) {
Function runMediaPluginFunction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
player: MediaPlayer,
trackedPlayer: TrackedPlayer,
eventType: EventType,
eventData: EventData | unknown = {},
trackError: (error: VimeoError) => void
Function getUsefulSchema
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getUsefulSchema(sb: PayloadBuilder): string {
let eventJson = sb.getJson();
for (const json of eventJson) {
if (json.keyIfEncoded === 'ue_px' && typeof json.json['data'] === 'object') {
const schema = (json.json['data'] as Record<string, unknown>)['schema'];
- 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 PerformanceNavigationTimingPlugin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function PerformanceNavigationTimingPlugin(): BrowserPlugin {
return {
activateBrowserPlugin: () => {
/* Setup a PerformanceObserver to allow caching of a completed navigation timing entry. We don't need to query the API after that. */
if (typeof PerformanceObserver !== '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 startVimeoTracking
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function startVimeoTracking(args: VimeoTrackingConfiguration): void {
const { video, ...config } = args;
if (video === undefined) {
LOG.error("Property 'video' is undefined");
} else if (video instanceof HTMLIFrameElement && video.nodeName !== 'IFRAME') {
- 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 GaCookiesPlugin
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function GaCookiesPlugin(pluginOptions: GACookiesPluginOptions = defaultPluginOptions): BrowserPlugin {
return {
contexts: () => {
const contexts: SelfDescribingJson<Record<string, unknown>>[] = [];
const { ga4, ga4MeasurementId, ua, cookiePrefix } = { ...defaultPluginOptions, ...pluginOptions };
- 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 newInMemoryEventStore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function newInMemoryEventStore({
maxSize = 1000,
events = [],
}: EventStoreConfiguration & InMemoryEventStoreConfiguration): EventStore {
let store: EventStorePayload[] = [...events];
- 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 attachWebVitalsPageListeners
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function attachWebVitalsPageListeners(callback: () => void) {
// Safari does not fire "visibilitychange" on the tab close
// So we have 2 options: lose Safari data, or lose LCP/CLS that depends on "visibilitychange" logic.
// Current solution: if LCP/CLS supported, use `onHidden` otherwise, use `pagehide` to fire the callback in the end.
//
- 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 constructNavigationTimingContext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function constructNavigationTimingContext(
performanceNavigationTimingInstance: PerformanceNavigationTimingContext
) {
const performanceNavigationKeys = [
'entryType',
- 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"