teamdigitale/italia-app

View on GitHub
ts/features/messages/analytics/index.ts

Summary

Maintainability
F
4 days
Test Coverage

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

import * as t from "io-ts";
import * as O from "fp-ts/lib/Option";
import * as S from "fp-ts/lib/string";
import { pipe } from "fp-ts/lib/function";
import { NonEmptyString } from "@pagopa/ts-commons/lib/strings";
Severity: Minor
Found in ts/features/messages/analytics/index.ts - About 7 hrs to fix

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

    export const trackUxConversion = (tag: MessageCategory["tag"]) => {
      const eventName = `${S.toUpperCase(tag)}_UX_CONVERSION`;
      const props = buildEventProperties("UX", "action");
      void mixpanelTrack(eventName, props);
    };
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 185..189
    ts/features/messages/analytics/index.ts on lines 203..207

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

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

    export const trackDisclaimerOpened = (tag: MessageCategory["tag"]) => {
      const eventName = `${S.toUpperCase(tag)}_DISCLAIMER_OPENED`;
      const props = buildEventProperties("UX", "screen_view");
      void mixpanelTrack(eventName, props);
    };
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 191..195
    ts/features/messages/analytics/index.ts on lines 203..207

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

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

    export const trackNotificationRejected = (tag: MessageCategory["tag"]) => {
      const eventName = `${S.toUpperCase(tag)}_NOTIFICATION_REJECTED`;
      const props = buildEventProperties("UX", "exit");
      void mixpanelTrack(eventName, props);
    };
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 185..189
    ts/features/messages/analytics/index.ts on lines 191..195

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

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

    export const trackThirdPartyMessageAttachmentUnavailable = (
      messageId: UIMessageId,
      serviceId: ServiceId | undefined
    ) => {
      const eventName = "THIRD_PARTY_MESSAGE_ATTACHMENT_UNAVAILABLE";
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 127..137
    ts/features/messages/analytics/index.ts on lines 139..149

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

    export const trackThirdPartyMessageAttachmentDownloadFailed = (
      messageId: UIMessageId,
      serviceId: ServiceId | undefined
    ) => {
      const eventName = "THIRD_PARTY_MESSAGE_ATTACHMENT_DOWNLOAD_FAILED";
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 115..125
    ts/features/messages/analytics/index.ts on lines 139..149

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

    export const trackThirdPartyMessageAttachmentBadFormat = (
      messageId: UIMessageId,
      serviceId: ServiceId | undefined
    ) => {
      const eventName = "THIRD_PARTY_MESSAGE_ATTACHMENT_BAD_FORMAT";
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 115..125
    ts/features/messages/analytics/index.ts on lines 127..137

    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 const trackRemoteContentMessageDecodingWarning = (
      serviceId: ServiceId,
      serviceName: string | undefined,
      organizationName: string | undefined,
      organizationFiscalCode: string | undefined,
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 293..311

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

    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 const trackPaymentStatus = (
      serviceId: ServiceId | undefined,
      serviceName: string | undefined,
      organizationName: string | undefined,
      organizationFiscalCode: string | undefined,
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 1 hr to fix
    ts/features/fims/common/analytics/index.ts on lines 65..81

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

    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 const trackRemoteContentLoadFailure = (
      serviceId: ServiceId | undefined,
      serviceName: string | undefined,
      organizationName: string | undefined,
      organizationFiscalCode: string | undefined,
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 349..367

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

    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 const trackThirdPartyMessageAttachmentUserAction = (
      userAction: "download" | "share"
    ) => {
      const eventName = "THIRD_PARTY_MESSAGE_ATTACHMENT_USER_ACTION";
      const props = buildEventProperties("UX", "action", {
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 1 hr to fix
    ts/features/pushNotifications/analytics/index.ts on lines 74..82

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

    export const trackMessageDataLoadRequest = (fromPushNotification: boolean) => {
      const eventName = "MESSAGE_DATA_LOAD_REQUEST";
      const props = buildEventProperties("TECH", undefined, {
        fromPushNotification: booleanToYesNo(fromPushNotification)
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 321..327
    ts/features/messages/analytics/index.ts on lines 341..347

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

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

    export const trackMessageDataLoadSuccess = (fromPushNotification: boolean) => {
      const eventName = "MESSAGE_DATA_LOAD_SUCCESS";
      const props = buildEventProperties("TECH", undefined, {
        fromPushNotification: booleanToYesNo(fromPushNotification)
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 313..319
    ts/features/messages/analytics/index.ts on lines 321..327

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

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

    export const trackMessageDataLoadPending = (fromPushNotification: boolean) => {
      const eventName = "MESSAGE_DATA_LOAD_PENDING";
      const props = buildEventProperties("TECH", undefined, {
        fromPushNotification: booleanToYesNo(fromPushNotification)
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 2 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 313..319
    ts/features/messages/analytics/index.ts on lines 341..347

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

    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 const trackRemoteContentLoadRequest = (
      serviceId: ServiceId,
      serviceName: string | undefined,
      organizationName: string | undefined,
      organizationFiscalCode: string | undefined,
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 275..291

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

    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 const trackRemoteContentLoadSuccess = (
      serviceId: ServiceId | undefined,
      serviceName: string | undefined,
      organizationName: string | undefined,
      organizationFiscalCode: string | undefined,
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 257..273

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

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

    export const trackLoadPreviousPageMessagesFailure = (reason: string) => {
      const eventName = "FAILURE_LOAD_PREVIOUS_PAGE_MESSAGES";
      const props = buildEventProperties("TECH", undefined, {
        reason
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 209..215
    ts/features/messages/analytics/index.ts on lines 217..223
    ts/features/messages/analytics/index.ts on lines 225..231
    ts/features/messages/analytics/index.ts on lines 241..247
    ts/features/messages/analytics/index.ts on lines 249..255

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

    export const trackLoadMessageDetailsFailure = (reason: string) => {
      const eventName = "FAILURE_LOAD_MESSAGE_DETAILS";
      const props = buildEventProperties("TECH", undefined, {
        reason
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 209..215
    ts/features/messages/analytics/index.ts on lines 225..231
    ts/features/messages/analytics/index.ts on lines 233..239
    ts/features/messages/analytics/index.ts on lines 241..247
    ts/features/messages/analytics/index.ts on lines 249..255

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

    export const trackUpsertMessageStatusAttributesFailure = (reason: string) => {
      const eventName = "FAILURE_UPSERT_MESSAGE_STATUS_ATTRIBUTES";
      const props = buildEventProperties("TECH", undefined, {
        reason
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 209..215
    ts/features/messages/analytics/index.ts on lines 217..223
    ts/features/messages/analytics/index.ts on lines 225..231
    ts/features/messages/analytics/index.ts on lines 233..239
    ts/features/messages/analytics/index.ts on lines 241..247

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

    export const trackReloadAllMessagesFailure = (reason: string) => {
      const eventName = "FAILURE_RELOAD_ALL_MESSAGES";
      const props = buildEventProperties("TECH", undefined, {
        reason
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 209..215
    ts/features/messages/analytics/index.ts on lines 217..223
    ts/features/messages/analytics/index.ts on lines 225..231
    ts/features/messages/analytics/index.ts on lines 233..239
    ts/features/messages/analytics/index.ts on lines 249..255

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

    export const trackLoadMessageByIdFailure = (reason: string) => {
      const eventName = "FAILURE_LOAD_MESSAGE_BY_ID";
      const props = buildEventProperties("TECH", undefined, {
        reason
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 217..223
    ts/features/messages/analytics/index.ts on lines 225..231
    ts/features/messages/analytics/index.ts on lines 233..239
    ts/features/messages/analytics/index.ts on lines 241..247
    ts/features/messages/analytics/index.ts on lines 249..255

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

    export const trackLoadNextPageMessagesFailure = (reason: string) => {
      const eventName = "FAILURE_LOAD_NEXT_PAGE_MESSAGES";
      const props = buildEventProperties("TECH", undefined, {
        reason
      });
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 1 hr to fix
    ts/features/messages/analytics/index.ts on lines 209..215
    ts/features/messages/analytics/index.ts on lines 217..223
    ts/features/messages/analytics/index.ts on lines 233..239
    ts/features/messages/analytics/index.ts on lines 241..247
    ts/features/messages/analytics/index.ts on lines 249..255

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

    export const trackMessageSearchPage = () => {
      const eventName = `MESSAGES_SEARCH_PAGE`;
      const props = buildEventProperties("UX", "screen_view");
      void mixpanelTrack(eventName, props);
    };
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 40 mins to fix
    ts/features/fims/common/analytics/index.ts on lines 101..105
    ts/features/fims/common/analytics/index.ts on lines 107..111
    ts/features/fims/common/analytics/index.ts on lines 113..117
    ts/features/messages/analytics/index.ts on lines 444..448
    ts/features/messages/analytics/index.ts on lines 450..454

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

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

    export const trackMessageSearchSelection = () => {
      const eventName = `MESSAGES_SEARCH_RESULT_SELECTED`;
      const props = buildEventProperties("UX", "action");
      void mixpanelTrack(eventName, props);
    };
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 40 mins to fix
    ts/features/fims/common/analytics/index.ts on lines 101..105
    ts/features/fims/common/analytics/index.ts on lines 107..111
    ts/features/fims/common/analytics/index.ts on lines 113..117
    ts/features/messages/analytics/index.ts on lines 430..434
    ts/features/messages/analytics/index.ts on lines 450..454

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

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

    export const trackMessageSearchClosing = () => {
      const eventName = `MESSAGES_SEARCH_CLOSE`;
      const props = buildEventProperties("UX", "action");
      void mixpanelTrack(eventName, props);
    };
    Severity: Major
    Found in ts/features/messages/analytics/index.ts and 5 other locations - About 40 mins to fix
    ts/features/fims/common/analytics/index.ts on lines 101..105
    ts/features/fims/common/analytics/index.ts on lines 107..111
    ts/features/fims/common/analytics/index.ts on lines 113..117
    ts/features/messages/analytics/index.ts on lines 430..434
    ts/features/messages/analytics/index.ts on lines 444..448

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

    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 const trackMessageSearchResult = (resultCount: number) => {
      const eventName = `MESSAGES_SEARCH_RESULT_PAGE`;
      const props = buildEventProperties("UX", "screen_view", {
        count_result_returned: resultCount
      });
    Severity: Minor
    Found in ts/features/messages/analytics/index.ts and 1 other location - About 30 mins to fix
    ts/features/fims/common/analytics/index.ts on lines 119..123

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

    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