DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

File AboutScreen.tsx has 331 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { Feather, MaterialCommunityIcons } from "@expo/vector-icons";
import { Image } from "expo-image";
import { ImageBackground, View } from "react-native";
import { AppIcon } from "@components/icons/AppIcon";
import {

    File LoansNavigator.tsx has 331 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { createStackNavigator } from "@react-navigation/stack";
    import { HeaderFont } from "@components/Text";
    import { HeaderTitle } from "@components/HeaderTitle";
    import { translate } from "@translations";
    import BigNumber from "bignumber.js";
    Severity: Minor
    Found in mobile-app/app/screens/AppNavigator/screens/Loans/LoansNavigator.tsx - About 3 hrs to fix

      Function AddOrRemoveCollateralForm has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

        ({ route }: Props): JSX.Element => {
          const { isLight } = useThemeContext();
          const {
            token,
            activePrice,

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

      import {
        ThemedIcon,
        ThemedTextV2,
        ThemedTouchableOpacityV2,
        ThemedViewV2,

        Function BottomSheetAddressDetailV2 has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

        export const BottomSheetAddressDetailV2 = (
          props: BottomSheetAddressDetailProps,
        ): React.MemoExoticComponent<() => JSX.Element> =>
          memo(() => {
            const { isLight } = useThemeContext();

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

        export function TransactionAuthorization(): JSX.Element | null {
          const { data: providerData } = useWalletNodeContext();
          const { clearWallets } = useWalletPersistenceContext();
          const { network } = useNetworkContext();
          const whaleApiClient = useWhaleApiClient();

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

        export function ConfirmPlaceBidScreen(props: Props): JSX.Element {
          const navigation = useNavigation<NavigationProp<AuctionsParamList>>();
          const dispatch = useAppDispatch();
          const logger = useLogger();
          const hasPendingJob = useSelector((state: RootState) =>

          Function SummaryTitle has 166 lines of code (exceeds 100 allowed). Consider refactoring.
          Open

          export function SummaryTitle(props: ISummaryTitleProps): JSX.Element {
            const IconA = getNativeIcon(props.iconA);
            const IconB =
              props.iconB !== undefined ? getNativeIcon(props.iconB) : undefined;
            const { networkName } = useNetworkContext();
          Severity: Major
          Found in mobile-app/app/components/SummaryTitle.tsx - About 3 hrs to fix

            File OceanInterface.tsx has 316 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {
              getMetaScanTxUrl,
              useDeFiScanContext,
            } from "@shared-contexts/DeFiScanContext";
            import { useWalletContext } from "@shared-contexts/WalletContext";
            Severity: Minor
            Found in mobile-app/app/components/OceanInterface/OceanInterface.tsx - About 3 hrs to fix

              Function PaybackLoanScreen has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
              Open

              export function PaybackLoanScreen({ navigation, route }: Props): JSX.Element {
                const routeParams = route.params;
                const client = useWhaleApiClient();
                const dispatch = useAppDispatch();
                const [vault, setVault] = useState(routeParams.vault);

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

              export function ActionButtons(): JSX.Element {
                const { isFeatureAvailable } = useFeatureFlagContext();
                const { domain, isEvmFeatureEnabled } = useDomainContext();
                const isEvmDomain = domain === DomainType.EVM;
              
              

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

              export function DFIPDetailScreen(): JSX.Element {
                const logger = useLogger();
                const dispatch = useAppDispatch();
                const navigation = useNavigation<NavigationProp<PortfolioParamList>>();
                const { isLight } = useThemeContext();

                Function BorrowLoanTokenScreen has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                export function BorrowLoanTokenScreen({
                  route,
                  navigation,
                }: Props): JSX.Element {
                  const client = useWhaleApiClient();

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

                async function send(
                  { address, token, amount, domain, networkName, nonce, chainId }: SendForm,
                  dispatch: Dispatch<any>,
                  onBroadcast: () => void,
                  logger: NativeLoggingProps,

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

                export function ConfirmSummaryTitle(
                  props: ConfirmSummaryTitleV2Props
                ): JSX.Element {
                  const IconA = getNativeIcon(props.iconA);
                  const IconB = getNativeIcon(props.iconB);
                Severity: Major
                Found in mobile-app/app/components/ConfirmSummaryTitle.tsx - About 3 hrs to fix

                  Function WalletTextInput has 160 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/WalletTextInput.tsx - About 3 hrs to fix

                    File DexConfirmRemoveLiquidity.tsx has 308 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import { WalletAlert } from "@components/WalletAlert";
                    import { CTransactionSegWit } from "@defichain/jellyfish-transaction";
                    import { PoolPairData } from "@defichain/whale-api-client/dist/api/poolpairs";
                    import { WhaleWalletAccount } from "@defichain/whale-api-wallet";
                    import { NavigationProp, useNavigation } from "@react-navigation/native";

                      File EditLoanSchemeScreen.tsx has 307 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

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

                        File BatchCard.tsx has 305 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import * as React from "react";
                        import { memo, useMemo, useState } from "react";
                        import { Text, View, LayoutChangeEvent } from "react-native";
                        import {
                          ThemedText,

                          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";
                            Severity
                            Category
                            Status
                            Source
                            Language