DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

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

function VaultDetail(props: { vault: LoanVaultActive }): JSX.Element {
  const { vault } = props;
  const colRatio = new BigNumber(vault.informativeRatio);
  const minColRatio = new BigNumber(vault.loanScheme.minColRatio);
  const totalLoanAmount = new BigNumber(vault.loanValue);

    File WalletTextInput.tsx has 279 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { forwardRef, useCallback, useState } from "react";
    import {
      NativeSyntheticEvent,
      Platform,
      TextInputFocusEventData,
    Severity: Minor
    Found in mobile-app/app/components/WalletTextInput.tsx - About 2 hrs to fix

      File SettingsNavigator.tsx has 277 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import { createStackNavigator } from "@react-navigation/stack";
      import { translate } from "@translations";
      import { NavigationProp, useNavigation } from "@react-navigation/native";
      import { useNavigatorScreenOptions } from "@hooks/useNavigatorScreenOptions";
      import { HeaderNetworkStatus } from "@components/HeaderNetworkStatus";

        Function NumberRowV2 has 141 lines of code (exceeds 100 allowed). Consider refactoring.
        Open

        export function NumberRowV2(props: INumberRowProps): JSX.Element {
          return (
            <ThemedViewV2
              style={
                props.containerStyle?.style ??
        Severity: Major
        Found in mobile-app/app/components/NumberRowV2.tsx - About 2 hrs to fix

          Function ServiceProviderScreen has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          export function ServiceProviderScreen({ navigation }: Props): JSX.Element {
            const { isEvmFeatureEnabled } = useDomainContext();
            const logger = useLogger();
            const dispatch = useAppDispatch();
            // show all content for small screen and web to adjust margins and paddings

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

          export const useLoanPaymentTokenRate = (props: {
            loanTokenAmountActivePriceInUSD: BigNumber;
            loanToken: {
              id: string;
              displaySymbol: string;

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

            (props: WalletTextInputProps, ref: React.Ref<any>): JSX.Element => {
              const [isFocus, setIsFocus] = useState(false);
              const {
                title,
                titleTestID,
          Severity: Minor
          Found in mobile-app/app/components/WalletTextInput.tsx - About 2 hrs 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 ConfirmCompositeSwapScreen has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

          export function ConfirmCompositeSwapScreen({ route }: Props): JSX.Element {
            const {
              conversion,
              fee,
              pairs,

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

          export function ReceiveScreen(): JSX.Element {
            const logger = useLogger();
            const { address, evmAddress } = useWalletContext();
            const [showToast, setShowToast] = useState(false);
            const toast = useToast();

            Function SendConfirmationScreen has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
            Open

            export function SendConfirmationScreen({ route }: Props): JSX.Element {
              const { domain } = useDomainContext();
              const { address, evmAddress } = useWalletContext();
              const addressLabel = useAddressLabel(address);
              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

            Function PlaceBidScreen has a Cognitive Complexity of 18 (exceeds 5 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),
              );

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

            export function VaultDetailScreen({ route, navigation }: Props): JSX.Element {
              const { isLight } = useThemeContext();
              const { vaultId } = route.params;
              const [vault, setVault] = useState<LoanVault>();
              const canUseOperations = useLoanOperations(vault?.state);

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

            export function TransactionDetailsSection(
              props: TransactionDetailsProps,
            ): JSX.Element {
              const isEmptyBorrowAmount =
                new BigNumber(props.borrowAmount).isNaN() ||

              Function CreateVaultScreen has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              export function CreateVaultScreen({ navigation, route }: Props): JSX.Element {
                const dispatch = useAppDispatch();
                const client = useWhaleApiClient();
                const { network } = useNetworkContext();
                const { address } = useWalletContext();

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

                function WalletStacks(): JSX.Element {
                  const { width } = Dimensions.get("window");
              
                  return (
                    <WalletStack.Navigator
              Severity: Major
              Found in mobile-app/app/screens/WalletNavigator/WalletNavigator.tsx - About 2 hrs to fix

                File SwapSummary.tsx has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { Linking, Platform, TouchableOpacity, View } from "react-native";
                import { NumericFormat as NumberFormat } from "react-number-format";
                import BigNumber from "bignumber.js";
                import { tailwind } from "@tailwind";
                import { translate } from "@translations";

                  File ConfirmPlaceBidScreen.tsx has 260 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { Dispatch, useEffect, useState } from "react";
                  import { useSelector } from "react-redux";
                  import { NavigationProp, useNavigation } from "@react-navigation/native";
                  import { StackScreenProps } from "@react-navigation/stack";
                  import { tailwind } from "@tailwind";

                    Function NoTokensDark has 131 lines of code (exceeds 100 allowed). Consider refactoring.
                    Open

                    export function NoTokensDark(): JSX.Element {
                      return (
                        <Svg width="114" height="97" viewBox="0 0 114 97" fill="none">
                          <Path
                            d="M63.2855 95.153C88.4917 95.153 108.927 74.718 108.927 49.4218C108.927 24.1256 88.4017 3.69055 63.2855 3.69055C38.0793 3.69055 17.6443 24.1256 17.6443 49.4218C17.6443 74.718 38.0793 95.153 63.2855 95.153Z"

                      Function TokenSelectionScreen has 130 lines of code (exceeds 100 allowed). Consider refactoring.
                      Open

                      export function TokenSelectionScreen(): JSX.Element {
                        const { isLight } = useThemeContext();
                        const { domain } = useDomainContext();
                        const navigation = useNavigation<NavigationProp<PortfolioParamList>>();
                        const tokens = useSelector((state: RootState) =>

                        File QuickBid.tsx has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import { ThemedTextV2, ThemedViewV2 } from "@components/themed";
                        import { memo, useEffect, useState } from "react";
                        import * as React from "react";
                        import { tailwind } from "@tailwind";
                        import { SymbolIcon } from "@components/SymbolIcon";
                          Severity
                          Category
                          Status
                          Source
                          Language