snowplow/snowplow-javascript-tracker

View on GitHub

Showing 145 of 325 total issues

Function Tracker has a Cognitive Complexity of 311 (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 6 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 873 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 851 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

      File index.ts has 975 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

        File core.ts has 671 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 newEmitter has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
          Open

          export function newEmitter({
            endpoint,
            eventMethod = 'post',
            protocol,
            port,
          Severity: Minor
          Found in libraries/tracker-core/src/emitter/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

          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 contexts.ts has 496 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 7 hrs to fix

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

              import { BrowserPlugin, BrowserTracker, dispatchToTrackersInCollection } from '@snowplow/browser-tracker-core';
              import { buildSelfDescribingEvent, resolveDynamicContext, 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 install-run.js has 459 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                // THIS FILE WAS GENERATED BY A TOOL. ANY MANUAL MODIFICATIONS WILL GET OVERWRITTEN WHENEVER RUSH IS UPGRADED.
                //
                // This script is intended for usage in an automated build environment where a Node tool may not have
                // been preinstalled, or may have an unpredictable version.  This script will automatically install the specified
                // version of the specified tool (if not already installed), and then pass a command-line to it.
                Severity: Minor
                Found in common/scripts/install-run.js - About 7 hrs to fix

                  Function trackerCore has 167 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 newEmitterRequest has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function newEmitterRequest({
                      endpoint,
                      protocol = 'https',
                      port,
                      eventMethod = 'post',
                    Severity: Minor
                    Found in libraries/tracker-core/src/emitter/emitter_request.ts - About 6 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

                    Function newCore has 148 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

                      Function trackerCore has a Cognitive Complexity of 34 (exceeds 5 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: Minor
                      Found in libraries/tracker-core/src/core.ts - About 5 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

                      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 29 (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

                        Function Plugins has 105 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 4 hrs to fix

                          Function 679877 has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
                          
                          __webpack_require__.r(__webpack_exports__);
                          /* harmony export */ __webpack_require__.d(__webpack_exports__, {
                          /* harmony export */   "isVariableSetInNpmrcFile": () => (/* binding */ isVariableSetInNpmrcFile),
                          Severity: Major
                          Found in common/scripts/install-run.js - About 4 hrs to fix

                            Function globalContexts has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function globalContexts(): GlobalContexts {
                              let globalPrimitives: Array<ContextPrimitive> = [];
                              let conditionalProviders: Array<ConditionalContextProvider> = [];
                              let namedPrimitives: Record<string, ContextPrimitive> = {};
                              let namedConditionalProviders: Record<string, ConditionalContextProvider> = {};
                            Severity: Minor
                            Found in libraries/tracker-core/src/contexts.ts - About 3 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