DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

File CloseVaultScreen.tsx has 303 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Dispatch, useEffect, useState } from "react";
import { Image } from "expo-image";
import { useSelector } from "react-redux";
import { StackScreenProps } from "@react-navigation/stack";
import { EnvironmentNetwork } from "@waveshq/walletkit-core";

    Function SummaryTransactionDetails has 156 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

    function SummaryTransactionDetails(
      props: SummaryTransactionDetailsProps
    ): JSX.Element {
      const borrowAmountUSD = new BigNumber(props.borrowAmount).multipliedBy(
        getActivePrice(props.loanToken.token.symbol, props.loanToken.activePrice)

      Function DexNavigator has 155 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      export function DexNavigator(): JSX.Element {
        const navigation = useNavigation<NavigationProp<DexParamList>>();
        const screenOptions = useNavigatorScreenOptions();
        const goToNetworkSelect = (): void => {
          navigation.navigate("NetworkSelectionScreenDex");
      Severity: Major
      Found in mobile-app/app/screens/AppNavigator/screens/Dex/DexNavigator.tsx - About 3 hrs to fix

        File ActionButtons.tsx has 299 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import {
          IconName,
          IconType,
          ThemedIcon,
          ThemedTextV2,

          File DexNavigator.tsx has 297 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { NavigationProp, useNavigation } from "@react-navigation/native";
          import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
          import { createStackNavigator } from "@react-navigation/stack";
          import BigNumber from "bignumber.js";
          import { HeaderFont } from "@components/Text";
          Severity: Minor
          Found in mobile-app/app/screens/AppNavigator/screens/Dex/DexNavigator.tsx - About 3 hrs to fix

            File BrowseAuctions.tsx has 296 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import { useCallback, useRef, useState } from "react";
            import { useScrollToTop } from "@react-navigation/native";
            import { tailwind } from "@tailwind";
            import { BatchCard } from "@screens/AppNavigator/screens/Auctions/components/BatchCard";
            import { Platform, View } from "react-native";

              Function SwapTokenSelectionScreen has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              export function SwapTokenSelectionScreen({ route }: Props): JSX.Element {
                const {
                  fromToken,
                  listType,
                  list,

              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 transfer_domain.ts has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import { translate } from "@translations";
              import BigNumber from "bignumber.js";
              import { ethers, providers, utils } from "ethers";
              import { DfTxSigner } from "@waveshq/walletkit-ui/dist/store";
              import { WhaleWalletAccount } from "@defichain/whale-api-wallet";
              Severity: Minor
              Found in mobile-app/app/api/transaction/transfer_domain.ts - About 3 hrs to fix

                File SwapTokenSelectionScreen.tsx has 293 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import BigNumber from "bignumber.js";
                import { StackScreenProps } from "@react-navigation/stack";
                import {
                  ThemedFlatListV2,
                  ThemedTextV2,

                  Function WalletNavigator has 150 lines of code (exceeds 100 allowed). Consider refactoring.
                  Open

                  export function WalletNavigator(): JSX.Element {
                    const { isLight } = useThemeContext();
                    const navigationRef =
                      useRef<NavigationContainerRef<ReactNavigation.RootParamList>>(null);
                    const DeFiChainTheme: Theme = getDefaultTheme(isLight);
                  Severity: Major
                  Found in mobile-app/app/screens/WalletNavigator/WalletNavigator.tsx - About 3 hrs to fix

                    Function BatchCard has 150 lines of code (exceeds 100 allowed). Consider refactoring.
                    Open

                    export function BatchCard(props: BatchCardProps): JSX.Element {
                      const navigation = useNavigation<NavigationProp<AuctionsParamList>>();
                      const { address } = useWalletContext();
                      const { batch, testID, vault, collateralTokenSymbols } = props;
                      const [progressBarHeight, setProgressBarHeight] = useState<number>(0);

                      File AddressControlScreen.tsx has 291 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { tailwind } from "@tailwind";
                      import {
                        ThemedIcon,
                        ThemedText,
                        ThemedTouchableOpacity,

                        Function useSwappableTokens has 149 lines of code (exceeds 100 allowed). Consider refactoring.
                        Open

                        export function useSwappableTokens(
                          fromTokenId: string | undefined,
                          fromTokenDisplaySymbol: string | undefined,
                          fromTokenSymbol: string | undefined,
                          isFutureSwap: boolean

                          File CreateVaultScreen.tsx has 289 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { View } from "@components";
                          import { ThemedScrollViewV2, ThemedTextV2 } from "@components/themed";
                          import { StackScreenProps } from "@react-navigation/stack";
                          import { useWhaleApiClient } from "@waveshq/walletkit-ui/dist/contexts";
                          import { tailwind } from "@tailwind";

                            Function useSwappableTokens has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function useSwappableTokens(
                              fromTokenId: string | undefined,
                              fromTokenDisplaySymbol: string | undefined,
                              fromTokenSymbol: string | undefined,
                              isFutureSwap: boolean

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

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

                            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 TotalPortfolio.tsx has 284 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { View } from "@components";
                            import { TextSkeletonLoader } from "@components/TextSkeletonLoader";
                            import { ThemedIcon, ThemedTextV2, ThemedViewV2 } from "@components/themed";
                            import { RootState } from "@store";
                            import { tailwind } from "@tailwind";

                              Function ConvertConfirmationScreen has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                              Open

                              export function ConvertConfirmationScreen({ route }: Props): JSX.Element {
                                const {
                                  amount,
                                  convertDirection,
                                  fee,

                              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 PasscodePrompt.tsx has 281 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import {
                                ThemedActivityIndicatorV2,
                                ThemedIcon,
                                ThemedTextV2,
                                ThemedTouchableOpacityV2,
                              Severity: Minor
                              Found in mobile-app/app/screens/TransactionAuthorization/PasscodePrompt.tsx - About 2 hrs to fix

                                Function WalletTextInputV2 has 143 lines of code (exceeds 100 allowed). Consider refactoring.
                                Open

                                  (props: WalletTextInputProps, ref: React.Ref<any>): JSX.Element => {
                                    const [isFocus, setIsFocus] = useState(false);
                                    const {
                                      title,
                                      titleTestID,
                                Severity: Major
                                Found in mobile-app/app/components/WalletTextInputV2.tsx - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language