snowplow/snowplow-javascript-tracker

View on GitHub

Showing 153 of 352 total issues

Function Tracker has a Cognitive Complexity of 287 (exceeds 5 allowed). Consider refactoring.
Open

export function Tracker(
  trackerId: string,
  namespace: string,
  version: string,
  endpoint: string,
Severity: Minor
Found in libraries/browser-tracker-core/src/tracker/index.ts - About 5 days 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 Tracker has 827 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function Tracker(
  trackerId: string,
  namespace: string,
  version: string,
  endpoint: string,
Severity: Major
Found in libraries/browser-tracker-core/src/tracker/index.ts - About 4 days to fix

    Function newTracker has 805 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      const newTracker = (
        trackerId: string,
        namespace: string,
        version: string,
        endpoint: string,
    Severity: Major
    Found in libraries/browser-tracker-core/src/tracker/index.ts - About 4 days to fix

      Function OutQueueManager has a Cognitive Complexity of 193 (exceeds 5 allowed). Consider refactoring.
      Open

      export function OutQueueManager(
        id: string,
        sharedSate: SharedState,
        useLocalStorage: boolean,
        eventMethod: string | boolean,
      Severity: Minor
      Found in libraries/browser-tracker-core/src/tracker/out_queue.ts - About 3 days 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

      File index.ts has 928 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import {
        trackerCore,
        buildPagePing,
        buildPageView,
        CommonEventProperties,
      Severity: Major
      Found in libraries/browser-tracker-core/src/tracker/index.ts - About 2 days to fix

        Function OutQueueManager has 408 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function OutQueueManager(
          id: string,
          sharedSate: SharedState,
          useLocalStorage: boolean,
          eventMethod: string | boolean,
        Severity: Major
        Found in libraries/browser-tracker-core/src/tracker/out_queue.ts - About 2 days to fix

          Function OptimizelyPlugin has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
          Open

          export function OptimizelyPlugin(
            summary: boolean = true,
            experiments: boolean = true,
            states: boolean = true,
            variations: boolean = true,
          Severity: Minor
          Found in plugins/browser-plugin-optimizely/src/index.ts - About 1 day 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

          File core.ts has 652 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: Major
          Found in libraries/tracker-core/src/core.ts - About 1 day to fix

            Function InQueueManager has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
            Open

            export function InQueueManager(functionName: string, asyncQueue: Array<unknown>): Queue {
              const windowAlias = window,
                documentAlias = document,
                sharedState: SharedState = createSharedState(),
                availableTrackerIds: Array<string> = [],
            Severity: Minor
            Found in trackers/javascript-tracker/src/in_queue.ts - About 1 day 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 OptimizelyPlugin has 209 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function OptimizelyPlugin(
              summary: boolean = true,
              experiments: boolean = true,
              states: boolean = true,
              variations: boolean = true,
            Severity: Major
            Found in plugins/browser-plugin-optimizely/src/index.ts - About 1 day to fix

              Function InQueueManager has 200 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function InQueueManager(functionName: string, asyncQueue: Array<unknown>): Queue {
                const windowAlias = window,
                  documentAlias = document,
                  sharedState: SharedState = createSharedState(),
                  availableTrackerIds: Array<string> = [],
              Severity: Major
              Found in trackers/javascript-tracker/src/in_queue.ts - About 1 day to fix

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

                import { BrowserPlugin, BrowserTracker, dispatchToTrackersInCollection } from '@snowplow/browser-tracker-core';
                import { buildSelfDescribingEvent, LOG, SelfDescribingJson } from '@snowplow/tracker-core';
                import { MediaTracking } from './mediaTracking';
                import { MediaPingInterval } from './pingInterval';
                import { MediaSessionTracking } from './sessionTracking';
                Severity: Minor
                Found in plugins/browser-plugin-media/src/api.ts - About 7 hrs to fix

                  File out_queue.ts has 445 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { attemptWriteLocalStorage, isString } from '../helpers';
                  import { SharedState } from '../state';
                  import { localStorageAccessible } from '../detectors';
                  import { LOG, Payload } from '@snowplow/tracker-core';
                  import { PAYLOAD_DATA_SCHEMA } from './schemata';
                  Severity: Minor
                  Found in libraries/browser-tracker-core/src/tracker/out_queue.ts - About 6 hrs to fix

                    File contexts.ts has 429 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 libraries/tracker-core/src/contexts.ts - About 6 hrs to fix

                      Function trackerCore has 156 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export function trackerCore(configuration: CoreConfiguration = {}): TrackerCore {
                        function newCore(base64: boolean, corePlugins: Array<CorePlugin>, callback?: (PayloadData: PayloadBuilder) => void) {
                          const pluginContextsHelper: PluginContexts = pluginContexts(corePlugins),
                            globalContextsHelper: GlobalContexts = globalContexts();
                      
                      
                      Severity: Major
                      Found in libraries/tracker-core/src/core.ts - About 6 hrs to fix

                        Function Plugins has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function Plugins(configuration: JavaScriptTrackerConfiguration) {
                          const {
                            performanceTiming,
                            gaCookies,
                            geolocation,
                        Severity: Major
                        Found in trackers/javascript-tracker/src/features.ts - About 5 hrs to fix

                          Function newCore has 137 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function newCore(base64: boolean, corePlugins: Array<CorePlugin>, callback?: (PayloadData: PayloadBuilder) => void) {
                              const pluginContextsHelper: PluginContexts = pluginContexts(corePlugins),
                                globalContextsHelper: GlobalContexts = globalContexts();
                          
                              let encodeBase64 = base64,
                          Severity: Major
                          Found in libraries/tracker-core/src/core.ts - About 5 hrs to fix

                            File install-run.js has 382 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            "use strict";
                            // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
                            // See the @microsoft/rush package's LICENSE file for license information.
                            var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
                                if (k2 === undefined) k2 = k;
                            Severity: Minor
                            Found in common/scripts/install-run.js - About 5 hrs to fix

                              Function runMediaPluginFunction has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export function runMediaPluginFunction(
                                player: MediaPlayer,
                                trackedPlayer: TrackedPlayer,
                                eventType: EventType,
                                eventData: EventData | unknown = {},
                              Severity: Major
                              Found in plugins/browser-plugin-vimeo-tracking/src/mediaPluginBinding.ts - About 4 hrs to fix

                                Function Plugins has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export function Plugins(configuration: JavaScriptTrackerConfiguration) {
                                  const {
                                    performanceTiming,
                                    gaCookies,
                                    geolocation,
                                Severity: Minor
                                Found in trackers/javascript-tracker/src/features.ts - About 4 hrs 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