Showing 153 of 352 total issues
Function globalContexts
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function globalContexts(): GlobalContexts {
let globalPrimitives: Array<ContextPrimitive> = [];
let conditionalProviders: Array<ConditionalContextProvider> = [];
/**
Function createSharedState
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createSharedState(): SharedState {
const sharedState = new SharedState(),
documentAlias = document,
windowAlias = window;
Function parseIdCookie
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function parseIdCookie(
id: string | undefined,
domainUserId: string,
memorizedSessionId: string,
memorizedVisitCount: number
Consider simplifying this complex logical expression. Open
if (isExtendedFormat) {
/* Index is used by Enrich, so it should not be changed. */
crossDomainParameterValue = [
domainUserId,
timestamp,
Function PerformanceTimingPlugin
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function PerformanceTimingPlugin(): BrowserPlugin {
/**
* Creates a context from the window.performance.timing object
*
* @returns object PerformanceTiming context
Function tracker
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function tracker(
emitters: Emitter | Array<Emitter>,
namespace: string,
appId: string,
encodeBase64: boolean
Function matchSchemaAgainstRuleSet
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function matchSchemaAgainstRuleSet(ruleSet: RuleSet, schema: string): boolean {
let rejectCount = 0;
let acceptCount = 0;
const acceptRules = ruleSet['accept'];
if (Array.isArray(acceptRules)) {
- 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 OptimizelyXPlugin
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function OptimizelyXPlugin(): BrowserPlugin {
/**
* Check that *both* optimizely and optimizely.get exist
*
* @param property - optimizely data property
Function base64decode
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function base64decode(encodedData: string): string {
// discuss at: http://locutus.io/php/base64_decode/
// original by: Tyler Akins (http://rumkin.com)
// improved by: Thunder.m
// improved by: Kevin van Zonneveld (http://kvz.io)
Function getPerformanceTimingContext
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getPerformanceTimingContext() {
var windowAlias = window,
performanceAlias =
windowAlias.performance ||
windowAlias.mozPerformance ||
Function addFormListeners
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function addFormListeners(tracker: BrowserTracker, configuration: FormTrackingConfiguration) {
const { options, context } = configuration,
trackingMarker = tracker.id + 'form',
config = getConfigurationForOptions(options);
Function ClientHintsPlugin
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function ClientHintsPlugin(includeHighEntropy?: boolean): BrowserPlugin {
const populateClientHints = () => {
const navigatorAlias = navigator;
const uaData = navigatorAlias.userAgentData;
Function payloadBuilder
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function payloadBuilder(): PayloadBuilder {
const dict: Payload = {},
allJson: EventJson = [],
jsonForProcessing: EventJson = [],
contextEntitiesForProcessing: SelfDescribingJson[] = [];
Function applyAsyncFunction
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function applyAsyncFunction(...args: any[]) {
// Outer loop in case someone push'es in zarg of arrays
for (let i = 0; i < args.length; i += 1) {
let parameterArray = args[i],
input = Array.prototype.shift.call(parameterArray);
Function trackingOptionsParser
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function trackingOptionsParser(id: string | YT.Player, conf?: MediaTrackingOptions): TrackingOptions {
const player = typeof id === 'string' ? undefined : id;
const elementId = typeof id === 'string' ? id : id.getIframe().id;
const defaultBoundaries = [10, 25, 50, 75];
const defaultUpdateRate = 500;
Function installAndRun
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs) {
const rushJsonFolder = findRushJsonFolder();
const rushCommonFolder = path.join(rushJsonFolder, 'common');
const rushTempFolder = _getRushTempFolder(rushCommonFolder);
const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
Function isRuleSet
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function isRuleSet(input: unknown): input is Record<string, unknown> {
const ruleSet = input as Record<string, unknown>;
let ruleCount = 0;
if (input != null && typeof input === 'object' && !Array.isArray(input)) {
if (Object.prototype.hasOwnProperty.call(ruleSet, 'accept')) {
- 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 ClientHintsPlugin
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function ClientHintsPlugin(includeHighEntropy?: boolean): BrowserPlugin {
const populateClientHints = () => {
const navigatorAlias = navigator;
const uaData = navigatorAlias.userAgentData;
- 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 a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function cookie(
name: string,
value?: string,
ttl?: number,
path?: 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"
Further reading
Function parseIdCookie
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
export function parseIdCookie(
id: string | undefined,
domainUserId: string,
memorizedSessionId: string,
memorizedVisitCount: number
- 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"