DeFiCh/wallet

View on GitHub

Showing 335 of 335 total issues

Function TotalPortfolio has 151 lines of code (exceeds 100 allowed). Consider refactoring.
Open

export function TotalPortfolio(props: TotalPortfolioProps): JSX.Element {
  const { hasFetchedToken } = useSelector((state: RootState) => state.wallet);
  const { domain } = useDomainContext();
  const isEvmDomain = domain === DomainType.EVM;
  const { hasFetchedVaultsData } = useSelector(

    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

                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

                    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 TotalPortfolio.tsx has 278 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";

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

                              Severity
                              Category
                              Status
                              Source
                              Language