DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

File SendScreen.tsx has 587 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Platform, TextInput, View } from "react-native";
import BigNumber from "bignumber.js";
import { Controller, useForm } from "react-hook-form";
import { useSelector } from "react-redux";

    Function AddOrRemoveCollateralScreen has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

    export function AddOrRemoveCollateralScreen({ route }: Props): JSX.Element {
      const { vault, collateralItem, collateralTokens, isAdd } = route.params;
      const [selectedCollateralItem, setSelectedCollateralItem] =
        useState<CollateralItem>(collateralItem);
    
    

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

    export function WithdrawFutureSwapScreen(props: Props): JSX.Element {
      const {
        futureSwap: { source, destination },
        executionBlock,
      } = props.route.params;

      Function RemoveLiquidityScreen has 322 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      export function RemoveLiquidityScreen(props: Props): JSX.Element {
        const logger = useLogger();
        const client = useWhaleApiClient();
        const toast = useToast();
        const [fee, setFee] = useState<BigNumber>(new BigNumber(0.0001));

        File AddOrEditAddressBookScreen.tsx has 569 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { MnemonicStorage } from "@api/wallet/mnemonic_storage";
        import {
          ThemedIcon,
          ThemedScrollViewV2,
          ThemedSectionTitleV2,

          Function AuctionDetailScreen has 315 lines of code (exceeds 100 allowed). Consider refactoring.
          Open

          export function AuctionDetailScreen(
            props: BatchDetailScreenProps
          ): JSX.Element {
            const { batch: batchFromParam, vault } = props.route.params;
            const [batch, setBatch] = useState<LoanVaultLiquidationBatch>(batchFromParam);

            Function BottomSheetAddressDetailV2 has 312 lines of code (exceeds 100 allowed). Consider refactoring.
            Open

              memo(() => {
                const { isLight } = useThemeContext();
                const flatListComponents = {
                  mobile: BottomSheetFlatList,
                  web: ThemedFlatListV2,

              File TokenDetailScreen.tsx has 559 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import * as React from "react";
              import { useEffect, useState } from "react";
              import { Linking, TouchableOpacity } from "react-native";
              import { tailwind } from "@tailwind";
              import BigNumber from "bignumber.js";

                File PoolPairCards.tsx has 557 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import BigNumber from "bignumber.js";
                import { View } from "@components";
                import {
                  ThemedFlashList,
                  ThemedTextV2,

                  Function PlaceBidScreen has 306 lines of code (exceeds 100 allowed). Consider refactoring.
                  Open

                  export function PlaceBidScreen(props: Props): JSX.Element {
                    const { batch, vault } = props.route.params;
                    const tokens = useSelector((state: RootState) =>
                      tokensSelector(state.wallet),
                    );

                    Function useDexStabilization has 293 lines of code (exceeds 100 allowed). Consider refactoring.
                    Open

                    export function useDexStabilization(
                      tokenA: DexStabilizationTokenA,
                      tokenB: DexStabilizationTokenB
                    ): {
                      dexStabilizationAnnouncement: Announcement | undefined;

                      File PaybackLoanScreen.tsx has 528 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { useEffect, useState } from "react";
                      import { StackScreenProps } from "@react-navigation/stack";
                      import { LoanParamList } from "@screens/AppNavigator/screens/Loans/LoansNavigator";
                      import { View } from "react-native";
                      import {

                        File EditCollateralScreen.tsx has 502 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { SymbolIcon } from "@components/SymbolIcon";
                        import {
                          ThemedIcon,
                          ThemedScrollView,
                          ThemedSectionTitle,

                          File SendConfirmationScreen.tsx has 490 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { WalletAlert } from "@components/WalletAlert";
                          import { Dispatch, useEffect, useState } from "react";
                          import { TouchableOpacity } from "react-native";
                          import { useSelector } from "react-redux";
                          import BigNumber from "bignumber.js";

                            File OCGConfirmScreen.tsx has 488 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import { StackScreenProps } from "@react-navigation/stack";
                            import {
                              ConversionParam,
                              PortfolioParamList,
                            } from "@screens/AppNavigator/screens/Portfolio/PortfolioNavigator";

                              File ConfirmEditCollateralScreen.tsx has 486 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import { ThemedScrollViewV2, ThemedTextV2 } from "@components/themed";
                              import BigNumber from "bignumber.js";
                              import { StackScreenProps } from "@react-navigation/stack";
                              import { tailwind } from "@tailwind";
                              import { translate } from "@translations";

                                Function CFPDetailScreen has 253 lines of code (exceeds 100 allowed). Consider refactoring.
                                Open

                                export function CFPDetailScreen(): JSX.Element {
                                  const logger = useLogger();
                                  const dispatch = useAppDispatch();
                                  const { isLight } = useThemeContext();
                                  const { networkName } = useNetworkContext();

                                  Function Vaults has 250 lines of code (exceeds 100 allowed). Consider refactoring.
                                  Open

                                  export function Vaults(props: VaultsProps): JSX.Element {
                                    const dispatch = useAppDispatch();
                                    const client = useWhaleApiClient();
                                    const isFocused = useIsFocused();
                                    const { address } = useWalletContext();

                                    File TokenBreakdownDetailsV2.tsx has 456 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    import { View } from "@components";
                                    import { TextSkeletonLoader } from "@components/TextSkeletonLoader";
                                    import { ThemedProps, ThemedTextV2, ThemedViewV2 } from "@components/themed";
                                    import { AddressToken } from "@defichain/whale-api-client/dist/api/address";
                                    import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";

                                      File DexScreen.tsx has 451 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
                                      import { NavigationProp, useNavigation } from "@react-navigation/native";
                                      import * as React from "react";
                                      import { useCallback, useEffect, useState } from "react";
                                      import BigNumber from "bignumber.js";
                                      Severity: Minor
                                      Found in mobile-app/app/screens/AppNavigator/screens/Dex/DexScreen.tsx - About 6 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language