snowplow/snowplow-javascript-tracker

View on GitHub

Showing 145 of 325 total issues

Function fixupUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function fixupUrl(hostName: string, href: string, referrer: string) {
  if (hostName === 'translate.googleusercontent.com') {
    // Google
    if (referrer === '') {
      referrer = href;
Severity: Minor
Found in libraries/browser-tracker-core/src/proxies.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getReferrer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function getReferrer(oldLocation?: string) {
  let windowAlias = window,
    fromQs =
      fromQuerystring('referrer', windowAlias.location.href) || fromQuerystring('referer', windowAlias.location.href);

Severity: Minor
Found in libraries/browser-tracker-core/src/helpers/index.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function newNodeEmitters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function newNodeEmitters(configuration: NodeEmitterConfiguration): Emitter[] {
  if (configuration.hasOwnProperty('customEmitter')) {
    const customEmitters = (configuration as CustomEmitter).customEmitter();
    return Array.isArray(customEmitters) ? customEmitters : [customEmitters];
  } else {
Severity: Minor
Found in trackers/node-tracker/src/tracker.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function base64decode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function base64decode(encodedData: string): string {
  //  discuss at: http://locutus.io/php/base64_decode/
  // original by: Tyler Akins (http://rumkin.com)
  // improved by: Thunder.m
  // improved by: Kevin van Zonneveld (http://kvz.io)
Severity: Minor
Found in libraries/tracker-core/src/base64.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function findMediaElement has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function findMediaElement(id: string): SearchResult {
  let el: HTMLElement | null = document.getElementById(id);

  if (!el) return { err: SEARCH_ERROR.NOT_FOUND };
  if (isHtmlAudioElement(el)) return { el };
Severity: Minor
Found in plugins/browser-plugin-media-tracking/src/findElem.ts - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Severity
Category
Status
Source
Language