snowplow/snowplow-javascript-tracker

View on GitHub
trackers/browser-tracker/src/api.ts

Summary

Maintainability
F
3 days
Test Coverage

File api.ts has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * Copyright (c) 2022 Snowplow Analytics Ltd, 2010 Anthon Pang
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
Severity: Minor
Found in trackers/browser-tracker/src/api.ts - About 2 hrs to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function trackPageView(event?: PageViewEvent & CommonEventProperties, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.trackPageView(event);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 226..233

    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 63.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function enableActivityTrackingCallback(
      configuration: ActivityTrackingConfiguration & ActivityTrackingConfigurationCallback,
      trackers?: Array<string>
    ) {
      dispatchToTrackers(trackers, (t) => {
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 374..378

    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 63.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function setUserId(userId?: string | null, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setUserId(userId);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 274..278

    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 59.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function setOptOutCookie(name?: string | null, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setOptOutCookie(name);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 286..290

    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 59.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function disableAnonymousTracking(
      configuration?: DisableAnonymousTrackingConfiguration,
      trackers?: Array<string>
    ) {
      dispatchToTrackers(trackers, (t) => {
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 214..218
    trackers/browser-tracker/src/api.ts on lines 362..366
    trackers/browser-tracker/src/api.ts on lines 489..496
    trackers/browser-tracker/src/api.ts on lines 503..507

    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 58.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function enableAnonymousTracking(
      configuration?: EnableAnonymousTrackingConfiguration,
      trackers?: Array<string>
    ) {
      dispatchToTrackers(trackers, (t) => {
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 214..218
    trackers/browser-tracker/src/api.ts on lines 362..366
    trackers/browser-tracker/src/api.ts on lines 474..481
    trackers/browser-tracker/src/api.ts on lines 503..507

    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 58.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function enableActivityTracking(configuration: ActivityTrackingConfiguration, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.enableActivityTracking(configuration);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 362..366
    trackers/browser-tracker/src/api.ts on lines 474..481
    trackers/browser-tracker/src/api.ts on lines 489..496
    trackers/browser-tracker/src/api.ts on lines 503..507

    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 58.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function flushBuffer(configuration?: FlushBufferConfiguration, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.flushBuffer(configuration);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 214..218
    trackers/browser-tracker/src/api.ts on lines 474..481
    trackers/browser-tracker/src/api.ts on lines 489..496
    trackers/browser-tracker/src/api.ts on lines 503..507

    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 58.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function clearUserData(configuration?: ClearUserDataConfiguration, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.clearUserData(configuration);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 214..218
    trackers/browser-tracker/src/api.ts on lines 362..366
    trackers/browser-tracker/src/api.ts on lines 474..481
    trackers/browser-tracker/src/api.ts on lines 489..496

    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 58.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setCustomUrl(url: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setCustomUrl(url);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 322..326
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setCollectorUrl(collectorUrl: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setCollectorUrl(collectorUrl);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 322..326

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setUserIdFromLocation(querystringField: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setUserIdFromLocation(querystringField);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 322..326
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function discardHashTag(enable: boolean, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.discardHashTag(enable);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 163..167

    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 56.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function discardBrace(enable: boolean, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.discardBrace(enable);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 151..155

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setReferrerUrl(url: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setReferrerUrl(url);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 322..326
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setUserIdFromReferrer(querystringField: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setUserIdFromReferrer(querystringField);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 322..326
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function setBufferSize(newBufferSize: number, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setBufferSize(newBufferSize);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 187..191

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setCookiePath(path: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setCookiePath(path);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 322..326
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export function setVisitorCookieTimeout(timeout: number, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setVisitorCookieTimeout(timeout);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 1 other location - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 349..353

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setDocumentTitle(title: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setDocumentTitle(title);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 322..326
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 8 locations. Consider refactoring.
    Open

    export function setUserIdFromCookie(cookieName: string, trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.setUserIdFromCookie(cookieName);
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 7 other locations - About 1 hr to fix
    trackers/browser-tracker/src/api.ts on lines 115..119
    trackers/browser-tracker/src/api.ts on lines 127..131
    trackers/browser-tracker/src/api.ts on lines 139..143
    trackers/browser-tracker/src/api.ts on lines 175..179
    trackers/browser-tracker/src/api.ts on lines 298..302
    trackers/browser-tracker/src/api.ts on lines 310..314
    trackers/browser-tracker/src/api.ts on lines 335..339

    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 56.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function updatePageActivity(trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.updatePageActivity();
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 45 mins to fix
    trackers/browser-tracker/src/api.ts on lines 103..107
    trackers/browser-tracker/src/api.ts on lines 240..244
    trackers/browser-tracker/src/api.ts on lines 251..255
    trackers/browser-tracker/src/api.ts on lines 460..464

    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 50.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function disableActivityTrackingCallback(trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.disableActivityTrackingCallback();
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 45 mins to fix
    trackers/browser-tracker/src/api.ts on lines 103..107
    trackers/browser-tracker/src/api.ts on lines 240..244
    trackers/browser-tracker/src/api.ts on lines 262..266
    trackers/browser-tracker/src/api.ts on lines 460..464

    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 50.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function preservePageViewId(trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.preservePageViewId();
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 45 mins to fix
    trackers/browser-tracker/src/api.ts on lines 103..107
    trackers/browser-tracker/src/api.ts on lines 240..244
    trackers/browser-tracker/src/api.ts on lines 251..255
    trackers/browser-tracker/src/api.ts on lines 262..266

    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 50.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function disableActivityTracking(trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.disableActivityTracking();
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 45 mins to fix
    trackers/browser-tracker/src/api.ts on lines 103..107
    trackers/browser-tracker/src/api.ts on lines 251..255
    trackers/browser-tracker/src/api.ts on lines 262..266
    trackers/browser-tracker/src/api.ts on lines 460..464

    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 50.

    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

    Further Reading

    Similar blocks of code found in 5 locations. Consider refactoring.
    Open

    export function newSession(trackers?: Array<string>) {
      dispatchToTrackers(trackers, (t) => {
        t.newSession();
      });
    }
    Severity: Major
    Found in trackers/browser-tracker/src/api.ts and 4 other locations - About 45 mins to fix
    trackers/browser-tracker/src/api.ts on lines 240..244
    trackers/browser-tracker/src/api.ts on lines 251..255
    trackers/browser-tracker/src/api.ts on lines 262..266
    trackers/browser-tracker/src/api.ts on lines 460..464

    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 50.

    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

    Further Reading

    There are no issues that match your filters.

    Category
    Status