snowplow/snowplow-javascript-tracker

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

Summary

Maintainability
F
3 days
Test Coverage

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

export function removeGlobalContexts(
  contexts: Array<ConditionalContextProvider | ContextPrimitive>,
  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 413..420

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

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 addGlobalContexts(
  contexts: Array<ConditionalContextProvider | ContextPrimitive>,
  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 428..435

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

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 372..376

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 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 224..231

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 272..276

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 284..288

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 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 212..216
trackers/browser-tracker/src/api.ts on lines 467..474
trackers/browser-tracker/src/api.ts on lines 482..489
trackers/browser-tracker/src/api.ts on lines 496..500

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 212..216
trackers/browser-tracker/src/api.ts on lines 360..364
trackers/browser-tracker/src/api.ts on lines 467..474
trackers/browser-tracker/src/api.ts on lines 482..489

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 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 212..216
trackers/browser-tracker/src/api.ts on lines 360..364
trackers/browser-tracker/src/api.ts on lines 482..489
trackers/browser-tracker/src/api.ts on lines 496..500

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 360..364
trackers/browser-tracker/src/api.ts on lines 467..474
trackers/browser-tracker/src/api.ts on lines 482..489
trackers/browser-tracker/src/api.ts on lines 496..500

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 212..216
trackers/browser-tracker/src/api.ts on lines 360..364
trackers/browser-tracker/src/api.ts on lines 467..474
trackers/browser-tracker/src/api.ts on lines 496..500

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 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 113..117
trackers/browser-tracker/src/api.ts on lines 125..129
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 320..324
trackers/browser-tracker/src/api.ts on lines 333..337

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 113..117
trackers/browser-tracker/src/api.ts on lines 125..129
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 333..337

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 113..117
trackers/browser-tracker/src/api.ts on lines 125..129
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 320..324
trackers/browser-tracker/src/api.ts on lines 333..337

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 113..117
trackers/browser-tracker/src/api.ts on lines 125..129
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 320..324
trackers/browser-tracker/src/api.ts on lines 333..337

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 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 113..117
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 320..324
trackers/browser-tracker/src/api.ts on lines 333..337

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 113..117
trackers/browser-tracker/src/api.ts on lines 125..129
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 320..324

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 125..129
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 173..177
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 320..324
trackers/browser-tracker/src/api.ts on lines 333..337

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 113..117
trackers/browser-tracker/src/api.ts on lines 125..129
trackers/browser-tracker/src/api.ts on lines 137..141
trackers/browser-tracker/src/api.ts on lines 296..300
trackers/browser-tracker/src/api.ts on lines 308..312
trackers/browser-tracker/src/api.ts on lines 320..324
trackers/browser-tracker/src/api.ts on lines 333..337

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 161..165

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 185..189

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 149..153

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 347..351

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 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 238..242
trackers/browser-tracker/src/api.ts on lines 249..253
trackers/browser-tracker/src/api.ts on lines 260..264
trackers/browser-tracker/src/api.ts on lines 453..457

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 101..105
trackers/browser-tracker/src/api.ts on lines 238..242
trackers/browser-tracker/src/api.ts on lines 260..264
trackers/browser-tracker/src/api.ts on lines 453..457

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 101..105
trackers/browser-tracker/src/api.ts on lines 249..253
trackers/browser-tracker/src/api.ts on lines 260..264
trackers/browser-tracker/src/api.ts on lines 453..457

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 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 101..105
trackers/browser-tracker/src/api.ts on lines 238..242
trackers/browser-tracker/src/api.ts on lines 249..253
trackers/browser-tracker/src/api.ts on lines 453..457

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 101..105
trackers/browser-tracker/src/api.ts on lines 238..242
trackers/browser-tracker/src/api.ts on lines 249..253
trackers/browser-tracker/src/api.ts on lines 260..264

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