Sorry, data for that comparison is no longer available.

teamdigitale/italia-app

View on GitHub
ts/features/messages/utils/__tests__/messages.test.ts

Summary

Maintainability
D
2 days
Test Coverage

File messages.test.ts has 301 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { OrganizationFiscalCode } from "@pagopa/ts-commons/lib/strings";
import * as O from "fp-ts/lib/Option";
import { CreatedMessageWithContent } from "../../../../../definitions/backend/CreatedMessageWithContent";
import { CreatedMessageWithContentAndAttachments } from "../../../../../definitions/backend/CreatedMessageWithContentAndAttachments";
import { FiscalCode } from "../../../../../definitions/backend/FiscalCode";
Severity: Minor
Found in ts/features/messages/utils/__tests__/messages.test.ts - About 3 hrs to fix

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

      it("should return an object with type UNEXPIRABLE if there a duedate but invalid_after_due_date is false", () => {
        const messagePaymentExpirationInfo = getMessagePaymentExpirationInfo(
          messageWithContent.content.payment_data as NonNullable<
            CreatedMessageWithContentAndAttachments["content"]["payment_data"]
          >,
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 1 other location - About 3 hrs to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 302..316

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

    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

      it("should return an object with type EXPIRABLE if there a duedate and invalid_after_due_date is true", () => {
        const messagePaymentExpirationInfo = getMessagePaymentExpirationInfo(
          messageInvalidAfterDueDate.content.payment_data as NonNullable<
            CreatedMessageWithContentAndAttachments["content"]["payment_data"]
          >,
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 1 other location - About 3 hrs to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 288..301

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

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

      it("should be not valid (wrong protocol)", async () => {
        const invalidProtocol: CTA = {
          text: "dummy",
          action: "iosit://PROFILE_MAIN"
        };
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 4 other locations - About 1 hr to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 211..215
    ts/features/messages/utils/__tests__/messages.test.ts on lines 226..230
    ts/features/messages/utils/__tests__/messages.test.ts on lines 232..239
    ts/features/messages/utils/__tests__/messages.test.ts on lines 241..248

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

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

      it("should be not valid (wrong route)", async () => {
        const invalidRoute: CTA = { text: "dummy", action: "iosit://WRONG_ROUTE" };
        const isValid = isCtaActionValid(invalidRoute);
        expect(isValid).toBeFalsy();
      });
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 4 other locations - About 1 hr to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 211..215
    ts/features/messages/utils/__tests__/messages.test.ts on lines 217..224
    ts/features/messages/utils/__tests__/messages.test.ts on lines 232..239
    ts/features/messages/utils/__tests__/messages.test.ts on lines 241..248

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

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

      it("should be a valid RN Linking (web)", async () => {
        const webCtaValid: CTA = {
          text: "dummy",
          action: "iohandledlink://https://www.google.it"
        };
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 4 other locations - About 1 hr to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 211..215
    ts/features/messages/utils/__tests__/messages.test.ts on lines 217..224
    ts/features/messages/utils/__tests__/messages.test.ts on lines 226..230
    ts/features/messages/utils/__tests__/messages.test.ts on lines 232..239

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

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

      it("should be a valid RN Linking", async () => {
        const phoneCtaValid: CTA = {
          text: "dummy",
          action: "iohandledlink://tel://3471615647"
        };
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 4 other locations - About 1 hr to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 211..215
    ts/features/messages/utils/__tests__/messages.test.ts on lines 217..224
    ts/features/messages/utils/__tests__/messages.test.ts on lines 226..230
    ts/features/messages/utils/__tests__/messages.test.ts on lines 241..248

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

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

      it("should be a valid internal navigation action", async () => {
        const valid: CTA = { text: "dummy", action: "ioit://PROFILE_MAIN" };
        const isValid = isCtaActionValid(valid);
        expect(isValid).toBeTruthy();
      });
    Severity: Major
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 4 other locations - About 1 hr to fix
    ts/features/messages/utils/__tests__/messages.test.ts on lines 217..224
    ts/features/messages/utils/__tests__/messages.test.ts on lines 226..230
    ts/features/messages/utils/__tests__/messages.test.ts on lines 232..239
    ts/features/messages/utils/__tests__/messages.test.ts on lines 241..248

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

    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

        if (ctas.cta_2) {
          expect(ctas.cta_2.text).toEqual(text2);
          expect(ctas.cta_2.action).toEqual(action2);
        }
    Severity: Minor
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 1 other location - About 45 mins to fix
    ts/utils/__tests__/content.test.ts on lines 153..156

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

    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

      it("should be None if there isn't payment data in the message", () => {
        const expirationInfo = paymentExpirationInfo(messageWithoutPaymentData);
        expect(O.isNone(expirationInfo)).toBe(true);
      });
    Severity: Minor
    Found in ts/features/messages/utils/__tests__/messages.test.ts and 1 other location - About 35 mins to fix
    scripts/ts/danger/__tests__/updatePrTitle.test.ts on lines 64..67

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

    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