Showing 145 of 325 total issues
Function newEmitterEvent
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function newEmitterEvent(eventStorePayload: EventStorePayload): EmitterEvent {
let querystring: string | null = null;
let postBody: Record<string, unknown> | null = null;
let byteCountGET: number | null = null;
let byteCountPOST: number | null = null;
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 addVideoEventListeners
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addVideoEventListeners(video: HTMLMediaElement, id: string) {
let isWaiting = false;
video.addEventListener('play', () => trackMediaPlay({ id, player: updatePlayer(video) }));
Function newTracker
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function newTracker(
trackerConfiguration: TrackerConfiguration,
emitterConfiguration: NodeEmitterConfiguration | NodeEmitterConfiguration[]
): Tracker {
const { namespace, appId, encodeBase64 = true } = trackerConfiguration;
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 newCookie
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function newCookie(name: string): Cookie {
let flushTimer: ReturnType<typeof setTimeout> | undefined;
let lastSetValueArgs: Parameters<typeof setValue> | undefined;
let cacheExpireAt: Date | undefined;
let flushed = true;
- 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 _trimNpmrcFile
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _trimNpmrcFile(options) {
const { sourceNpmrcPath, linesToPrepend, linesToAppend } = options;
const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath);
if (combinedNpmrcFromCache !== undefined) {
return combinedNpmrcFromCache;
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 installAndRun
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
const rushJsonFolder = findRushJsonFolder();
const rushCommonFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushJsonFolder, 'common');
const rushTempFolder = _getRushTempFolder(rushCommonFolder);
const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
Function getPerformanceTimingContext
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getPerformanceTimingContext() {
var windowAlias = window,
performanceAlias =
windowAlias.performance ||
windowAlias.mozPerformance ||
Function track
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function track<C = Record<string, unknown>>(
pb: PayloadBuilder,
context?: Array<SelfDescribingJson<C>> | null,
timestamp?: Timestamp | null
): Payload | undefined {
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 OptimizelyXPlugin
has 43 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 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 _run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _run() {
const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;
// Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the
// appropriate binary inside the rush package to run
const scriptName = path__WEBPACK_IMPORTED_MODULE_0__.basename(scriptPath);
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"