teamdigitale/italia-app

View on GitHub
ts/screens/wallet/payment/TransactionErrorScreen.tsx

Summary

Maintainability
F
4 days
Test Coverage

Function errorTransactionUIElements has 189 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export const errorTransactionUIElements = (
  maybeError: TransactionErrorScreenNavigationParams["error"],
  rptId: RptId,
  onCancel: () => void,
  choosenTool: ToolEnum,
Severity: Major
Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx - About 7 hrs to fix

    File TransactionErrorScreen.tsx has 396 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * The screen to display to the user the various types of errors that occurred during the transaction.
     * Inside the cancel and retry buttons are conditionally returned.
     */
    import {
    Severity: Minor
    Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx - About 5 hrs to fix

      Function errorTransactionUIElements has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      export const errorTransactionUIElements = (
        maybeError: TransactionErrorScreenNavigationParams["error"],
        rptId: RptId,
        onCancel: () => void,
        choosenTool: ToolEnum,
      Severity: Minor
      Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function TransactionErrorScreen has 38 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const TransactionErrorScreen = (props: Props) => {
        const { rptId, error, onCancel } =
          useRoute<
            Route<"PAYMENT_TRANSACTION_ERROR", TransactionErrorScreenNavigationParams>
          >().params;
      Severity: Minor
      Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx - About 1 hr to fix

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

            case "REVOKED":
              return {
                image,
                title: I18n.t("wallet.errors.REVOKED"),
                subtitle: (
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 3 hrs to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 300..314
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 332..346

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

        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

            case "EXPIRED":
              return {
                image,
                title: I18n.t("wallet.errors.EXPIRED"),
                subtitle: (
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 3 hrs to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 315..331
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 332..346

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

        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

            case "NOT_FOUND":
              return {
                image,
                title: I18n.t("wallet.errors.NOT_FOUND"),
                subtitle: (
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 3 hrs to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 300..314
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 315..331

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

        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

            case "TECHNICAL":
              return {
                image,
                title: I18n.t("wallet.errors.TECHNICAL"),
                subtitle,
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 248..259
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 260..271

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

        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

            case "EC":
              return {
                image,
                title: I18n.t("wallet.errors.EC"),
                subtitle,
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 236..247
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 248..259

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

        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

            case "DATA":
              return {
                image,
                title: I18n.t("wallet.errors.DATA"),
                subtitle,
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 236..247
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 260..271

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

        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

          const closeButtonConfirm: ComponentProps<typeof ButtonSolid> = {
            onPress: onCancel,
            label: I18n.t("global.buttons.close"),
            accessibilityLabel: I18n.t("global.buttons.close"),
            testID: "closeButtonConfirm"
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 3 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 180..185
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 194..199
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 201..206

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

          const sendReportButtonCancel: ComponentProps<typeof ButtonOutline> = {
            onPress: requestAssistance,
            label: I18n.t("wallet.errors.sendReport"),
            accessibilityLabel: I18n.t("wallet.errors.sendReport"),
            testID: "sendReportButtonCancel"
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 3 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 180..185
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 187..192
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 201..206

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

          const closeButtonCancel: ComponentProps<typeof ButtonOutline> = {
            onPress: onCancel,
            label: I18n.t("global.buttons.close"),
            accessibilityLabel: I18n.t("global.buttons.close"),
            testID: "closeButtonCancel"
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 3 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 180..185
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 187..192
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 194..199

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

          const sendReportButtonConfirm: ComponentProps<typeof ButtonSolid> = {
            onPress: requestAssistance,
            label: I18n.t("wallet.errors.sendReport"),
            accessibilityLabel: I18n.t("wallet.errors.sendReport"),
            testID: "sendReportButtonConfirm"
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 3 other locations - About 1 hr to fix
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 187..192
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 194..199
        ts/screens/wallet/payment/TransactionErrorScreen.tsx on lines 201..206

        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

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

          error: O.Option<
            PayloadForAction<
              | (typeof paymentVerifica)["failure"]
              | (typeof paymentAttiva)["failure"]
              | (typeof paymentIdPolling)["failure"]
        Severity: Minor
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 1 other location - About 55 mins to fix
        ts/utils/payment.ts on lines 461..467

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

        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

        const imageMapping: Record<ErrorTypes, IOPictograms> = {
          DATA: "attention",
          DUPLICATED: "attention",
          EC: "attention",
          ONGOING: "timing",
        Severity: Minor
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 2 other locations - About 35 mins to fix
        ts/features/bonus/cgn/navigation/routes.ts on lines 2..12
        ts/features/zendesk/navigation/routes.ts on lines 1..11

        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

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

        const mapStateToProps = (state: GlobalState) => ({
          paymentsHistory: paymentsHistorySelector(state),
          assistanceToolConfig: assistanceToolConfigSelector(state),
          canShowHelp: canShowHelpSelector(state)
        });
        Severity: Major
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 4 other locations - About 30 mins to fix
        ts/features/wallet/component/card/WalletV2PreviewCards.tsx on lines 66..70
        ts/features/wallet/onboarding/paypal/screen/PayPalOnboardingCheckoutScreen.tsx on lines 161..165
        ts/screens/wallet/PaymentHistoryDetailsScreen.tsx on lines 403..407
        ts/RootContainer.tsx on lines 131..135

        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

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

          const { rptId, error, onCancel } =
            useRoute<
              Route<"PAYMENT_TRANSACTION_ERROR", TransactionErrorScreenNavigationParams>
            >().params;
        Severity: Minor
        Found in ts/screens/wallet/payment/TransactionErrorScreen.tsx and 1 other location - About 30 mins to fix
        ts/screens/wallet/AddPaymentMethodScreen.tsx on lines 144..147

        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