snowplow/snowplow-javascript-tracker

View on GitHub

Showing 352 of 352 total issues

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

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

    export function trackPromotionView(
      promotionView: SPPromotion & CommonEcommerceEventProperties,
      trackers: Array<string> = Object.keys(_trackers)
    ) {
      const { context = [], timestamp, ...promotion } = promotionView;
    Severity: Major
    Found in plugins/browser-plugin-snowplow-ecommerce/src/api.ts and 3 other locations - About 5 hrs to fix
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 57..67
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 129..139
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 147..157

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

    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 4 locations. Consider refactoring.
    Open

    export function trackProductView(
      productView: Product & CommonEcommerceEventProperties,
      trackers: Array<string> = Object.keys(_trackers)
    ) {
      const { context = [], timestamp, ...product } = productView;
    Severity: Major
    Found in plugins/browser-plugin-snowplow-ecommerce/src/api.ts and 3 other locations - About 5 hrs to fix
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 57..67
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 111..121
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 129..139

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

    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 4 locations. Consider refactoring.
    Open

    export function trackCheckoutStep(
      checkoutStep: CheckoutStep & CommonEcommerceEventProperties,
      trackers: Array<string> = Object.keys(_trackers)
    ) {
      const { context = [], timestamp, ...checkoutStepAttributes } = checkoutStep;
    Severity: Major
    Found in plugins/browser-plugin-snowplow-ecommerce/src/api.ts and 3 other locations - About 5 hrs to fix
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 111..121
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 129..139
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 147..157

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

    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 4 locations. Consider refactoring.
    Open

    export function trackPromotionClick(
      promotionClick: SPPromotion & CommonEcommerceEventProperties,
      trackers: Array<string> = Object.keys(_trackers)
    ) {
      const { context = [], timestamp, ...promotion } = promotionClick;
    Severity: Major
    Found in plugins/browser-plugin-snowplow-ecommerce/src/api.ts and 3 other locations - About 5 hrs to fix
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 57..67
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 111..121
    plugins/browser-plugin-snowplow-ecommerce/src/api.ts on lines 147..157

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

    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

    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

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

      export function trackMediaAdResume(
        args: MediaTrackArguments &
          MediaTrackAdPercentProgressArguments &
          MediaTrackAdBreakArguments &
          MediaTrackAdArguments &
      Severity: Major
      Found in plugins/browser-plugin-media/src/api.ts and 1 other location - About 4 hrs to fix
      plugins/browser-plugin-media/src/api.ts on lines 390..410

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

      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 trackMediaAdSkip(
        args: MediaTrackArguments &
          MediaTrackAdPercentProgressArguments &
          MediaTrackAdBreakArguments &
          MediaTrackAdArguments &
      Severity: Major
      Found in plugins/browser-plugin-media/src/api.ts and 1 other location - About 4 hrs to fix
      plugins/browser-plugin-media/src/api.ts on lines 557..577

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

      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

      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

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

        export function trackMediaAdClick(
          args: MediaTrackArguments &
            MediaTrackAdPercentProgressArguments &
            MediaTrackAdBreakArguments &
            CommonMediaEventProperties,
        Severity: Major
        Found in plugins/browser-plugin-media/src/api.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-media/src/api.ts on lines 529..548

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

        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 trackMediaAdPause(
          args: MediaTrackArguments &
            MediaTrackAdPercentProgressArguments &
            MediaTrackAdBreakArguments &
            CommonMediaEventProperties,
        Severity: Major
        Found in plugins/browser-plugin-media/src/api.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-media/src/api.ts on lines 501..520

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

        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

        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

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

        export function trackConsentGranted(
          event: ConsentGrantedEvent & CommonEventProperties,
          trackers: Array<string> = Object.keys(_trackers)
        ) {
          dispatchToTrackersInCollection(trackers, _trackers, (t) => {
        Severity: Major
        Found in plugins/browser-plugin-consent/src/index.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-consent/src/index.ts on lines 160..172

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

        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 buildAddToCart(event: AddToCartEvent): PayloadBuilder {
          const { sku, quantity, name, category, unitPrice, currency } = event;
          return buildSelfDescribingEvent({
            event: {
              schema: 'iglu:com.snowplowanalytics.snowplow/add_to_cart/jsonschema/1-0-0',
        Severity: Major
        Found in libraries/tracker-core/src/core.ts and 1 other location - About 4 hrs to fix
        libraries/tracker-core/src/core.ts on lines 1132..1147

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

        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 buildRemoveFromCart(event: RemoveFromCartEvent): PayloadBuilder {
          const { sku, quantity, name, category, unitPrice, currency } = event;
          return buildSelfDescribingEvent({
            event: {
              schema: 'iglu:com.snowplowanalytics.snowplow/remove_from_cart/jsonschema/1-0-0',
        Severity: Major
        Found in libraries/tracker-core/src/core.ts and 1 other location - About 4 hrs to fix
        libraries/tracker-core/src/core.ts on lines 1087..1102

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

        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 trackConsentWithdrawn(
          event: ConsentWithdrawnEvent & CommonEventProperties,
          trackers: Array<string> = Object.keys(_trackers)
        ) {
          dispatchToTrackersInCollection(trackers, _trackers, (t) => {
        Severity: Major
        Found in plugins/browser-plugin-consent/src/index.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-consent/src/index.ts on lines 140..152

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

        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 trackMediaPictureInPictureChange(
          args: MediaTrackArguments & MediaTrackPictureInPictureChangeArguments & CommonMediaEventProperties,
          trackers: Array<string> = Object.keys(_trackers)
        ) {
          const { pictureInPicture } = args;
        Severity: Major
        Found in plugins/browser-plugin-media/src/api.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-media/src/api.ts on lines 297..315

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

        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 trackMediaFullscreenChange(
          args: MediaTrackArguments & MediaTrackFullscreenChangeArguments & CommonMediaEventProperties,
          trackers: Array<string> = Object.keys(_trackers)
        ) {
          const { fullscreen } = args;
        Severity: Major
        Found in plugins/browser-plugin-media/src/api.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-media/src/api.ts on lines 324..342

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

        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

          function getOptimizelyDimensionContexts() {
            var dimensionIds = getOptimizelyData('visitor', 'dimensions');
            if (dimensionIds) {
              var contexts = [];
        
        
        Severity: Major
        Found in plugins/browser-plugin-optimizely/src/index.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-optimizely/src/index.ts on lines 262..280

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

        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

          function getOptimizelyAudienceContexts() {
            var audienceIds = getOptimizelyData('visitor', 'audiences');
            if (audienceIds) {
              var contexts = [];
        
        
        Severity: Major
        Found in plugins/browser-plugin-optimizely/src/index.ts and 1 other location - About 4 hrs to fix
        plugins/browser-plugin-optimizely/src/index.ts on lines 287..305

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

        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

        Severity
        Category
        Status
        Source
        Language