Showing 353 of 353 total issues
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}`);
Identical blocks of code found in 2 locations. Consider refactoring. Open
export interface MediaAd extends Record<string, unknown> {
/** Friendly name of the ad */
name?: string;
/** Unique identifier for the ad */
adId: string;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
export interface MediaAdUpdate {
/** Friendly name of the ad */
name?: string;
/** Unique identifier for the ad */
adId: string;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 67.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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 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 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"
Further reading
Function enqueueRequest
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function enqueueRequest(request: Payload, url: string) {
configCollectorUrl = url + path;
const eventTooBigWarning = (bytes: number, maxBytes: number) =>
LOG.warn('Event (' + bytes + 'B) too big, max is ' + maxBytes);
Function WebVitalsPlugin
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function WebVitalsPlugin(pluginOptions: WebVitalsPluginOptions = defaultPluginOptions): BrowserPlugin {
const webVitalsObject: Record<string, unknown> = {};
const options = { ...defaultPluginOptions, ...pluginOptions };
let trackerId: string;
let webVitalsScript: HTMLScriptElement | undefined;
Similar blocks of code found in 2 locations. Consider refactoring. Open
export interface EnhancedEcommercePromoContext {
/** The promotion ID */
id?: string;
/** The name of the promotion */
name?: string;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
export interface ConsentGrantedEvent {
/** Identifier for the document granting consent */
id: string;
/** Version of the document granting consent */
version: string;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 66.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function logger
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function logger(logLevel: LOG_LEVEL = LOG_LEVEL.warn): Logger {
function setLogLevel(level: LOG_LEVEL) {
if (LOG_LEVEL[level]) {
logLevel = level;
} else {
Function jsonInterceptor
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function jsonInterceptor(encodeBase64: boolean): JsonProcessor {
const log = (jsonType: string, data: SelfDescribingJson) => {
const schemaParts = getSchemaParts(data['schema']);
debug(colours.event(), 'Event', [
'%c%s%c%s%c%s\n%o',
Function flush
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const flush = (): void => {
const bufferCopy = buffer;
buffer = [];
if (bufferCopy.length === 0) {
return;
Function trackingOptionsParser
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function trackingOptionsParser(id: string, trackingOptions?: MediaTrackingOptions): TrackingOptions {
const defaults: TrackingOptions = {
id: id,
captureEvents: DefaultEvents,
progress: {