DeFiCh/wallet

View on GitHub

Showing 335 of 335 total issues

Function AddOrEditAddressBookScreen has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

export function AddOrEditAddressBookScreen({
  route,
  navigation,
}: Props): JSX.Element {
  const { isEvmFeatureEnabled } = useDomainContext();

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 TokenBreakdownDetailsV2 has 240 lines of code (exceeds 100 allowed). Consider refactoring.
Open

export function TokenBreakdownDetailsV2(
  props: TokenBreakdownDetailProps,
): JSX.Element {
  const { denominationCurrency } = useDenominationCurrency();
  const lockedToken = (useTokenLockedBalance({

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

    export function InputHelperTextV2(props: InputHelperTextProps): JSX.Element {
      return (
        <ThemedViewV2
          light={tailwind("bg-transparent")}
          dark={tailwind("bg-transparent")}
    Severity: Major
    Found in mobile-app/app/components/InputHelperText.tsx and 1 other location - About 6 hrs to fix
    mobile-app/app/components/InputHelperText.tsx on lines 21..56

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

    export function InputHelperText(props: InputHelperTextProps): JSX.Element {
      return (
        <ThemedView
          light={tailwind("bg-transparent")}
          dark={tailwind("bg-transparent")}
    Severity: Major
    Found in mobile-app/app/components/InputHelperText.tsx and 1 other location - About 6 hrs to fix
    mobile-app/app/components/InputHelperText.tsx on lines 57..92

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File BottomSheetAddressDetailV2.tsx has 437 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { View } from "@components";
    import {
      ThemedIcon,
      ThemedText,
      ThemedTextV2,

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

      export function RecoveryWordsFaq(): JSX.Element {
        const faqContent: AccordionContent[] = [
          {
            title: translate(
              "components/RecoveryWordFaq",
      mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/EvmFeatureFaq.tsx on lines 9..97

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

      export function EvmFeatureFaq(): JSX.Element {
        const faqContent: AccordionContent[] = [
          {
            title: translate(
              "components/EvmFeatureFaq",
      mobile-app/app/screens/WalletNavigator/screens/CreateWallet/RecoveryWordsFaq.tsx on lines 9..97

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function AddressBookScreen has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
      Open

      export function AddressBookScreen({ route, navigation }: Props): JSX.Element {
        const { selectedAddress, onAddressSelect, disabledTab, addressDomainType } =
          route.params;
        const { isLight } = useThemeContext();
        const { network } = useNetworkContext();

      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

      File CreateOrEditAddressLabelForm.tsx has 420 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { memo, useCallback, useEffect, useState } from "react";
      import * as Clipboard from "expo-clipboard";
      import { StackScreenProps } from "@react-navigation/stack";
      import { BottomSheetWithNavRouteParam } from "@components/BottomSheetWithNav";
      import {

        File ConvertConfirmationScreen.tsx has 413 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { WalletAlert } from "@components/WalletAlert";
        import { ThemedScrollViewV2, ThemedViewV2 } from "@components/themed";
        import { NavigationProp, useNavigation } from "@react-navigation/native";
        import { StackScreenProps } from "@react-navigation/stack";
        import BigNumber from "bignumber.js";

          File PlaceBidScreen.tsx has 410 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { useEffect, useState, useCallback } from "react";
          import { Platform, View, Text } from "react-native";
          import { useSelector } from "react-redux";
          import { useForm } from "react-hook-form";
          import { StackScreenProps } from "@react-navigation/stack";

            Function PortfolioScreen has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

            export function PortfolioScreen({ navigation }: Props): JSX.Element {
              const { isLight } = useThemeContext();
              const { domain } = useDomainContext();
              const isEvmDomain = domain === DomainType.EVM;
              const isFocused = useIsFocused();

            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 AddressRow has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
            Open

            export function AddressRow({
              control,
              networkName,
              onContactButtonPress,
              onQrButtonPress,

            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

            File ConfirmBorrowLoanTokenScreen.tsx has 406 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              ThemedScrollViewV2,
              ThemedTextV2,
              ThemedViewV2,
            } from "@components/themed";

              File TransactionAuthorization.tsx has 404 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { CTransactionSegWit } from "@defichain/jellyfish-transaction/dist";
              import {
                JellyfishWallet,
                WalletHdNodeProvider,
              } from "@defichain/jellyfish-wallet";

                Function SettingsNavigator has 215 lines of code (exceeds 100 allowed). Consider refactoring.
                Open

                export function SettingsNavigator(): JSX.Element {
                  const navigation = useNavigation<NavigationProp<SettingsParamList>>();
                
                  const goToNetworkSelect = (): void => {
                    navigation.navigate("NetworkSelectionScreen");

                  Function LoansNavigator has 212 lines of code (exceeds 100 allowed). Consider refactoring.
                  Open

                  export function LoansNavigator(): JSX.Element {
                    const navigation = useNavigation<NavigationProp<LoanParamList>>();
                    const headerContainerTestId = "loans_header_container";
                    const screenOptions = useNavigatorScreenOptions();
                    const goToNetworkSelect = (): void => {
                  Severity: Major
                  Found in mobile-app/app/screens/AppNavigator/screens/Loans/LoansNavigator.tsx - About 5 hrs to fix

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

                    function RecoveryWordRow(props: {
                      index: number;
                      word: string;
                      border: boolean;
                    }): JSX.Element {
                    mobile-app/app/screens/AppNavigator/screens/Settings/screens/RecoveryWordsScreen.tsx on lines 50..83

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                    function RecoveryWordRow(props: {
                      index: number;
                      word: string;
                      border: boolean;
                    }): JSX.Element {
                    mobile-app/app/screens/WalletNavigator/screens/CreateWallet/CreateMnemonicWallet.tsx on lines 179..212

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

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Function RestoreMnemonicWallet has 211 lines of code (exceeds 100 allowed). Consider refactoring.
                    Open

                    export function RestoreMnemonicWallet(): JSX.Element {
                      const navigation = useNavigation<NavigationProp<WalletParamList>>();
                      const {
                        control,
                        formState: { isValid, isDirty },
                      Severity
                      Category
                      Status
                      Source
                      Language