DeFiCh/wallet

View on GitHub

Showing 335 of 335 total issues

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 {

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export function LiquidityMiningFaq(): JSX.Element {
            const faqContent: AccordionContent[] = [
              {
                title: translate(
                  "components/LiquidityMiningFaq",
          mobile-app/app/screens/AppNavigator/screens/Portfolio/screens/CfpDfipProposalsFaq.tsx on lines 9..112

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 327.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          export function CfpDfipProposalsFaq(): JSX.Element {
            const faqContent: AccordionContent[] = [
              {
                title: translate(
                  "components/CfpDfipProposalsFaq",
          mobile-app/app/screens/WalletNavigator/screens/CreateWallet/LiquidityMiningFaq.tsx on lines 9..112

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 327.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  export const ActiveUSDValue = React.memo(
                    (props: ActiveUSDValueProps): JSX.Element => {
                      return (
                        <View
                          style={[tailwind("flex flex-row items-center"), props.containerStyle]}
                  mobile-app/app/screens/AppNavigator/screens/Loans/VaultDetail/components/ActiveUSDValueV2.tsx on lines 23..60

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 309.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                  export const ActiveUSDValueV2 = React.memo(
                    (props: ActiveUSDValueProps): JSX.Element => {
                      return (
                        <View
                          style={[tailwind("flex flex-row items-center"), props.containerStyle]}
                  mobile-app/app/screens/AppNavigator/screens/Loans/VaultDetail/components/ActiveUSDValue.tsx on lines 23..60

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 309.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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();

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    export function LoansTokensSortRow(props: {
                      isSorted: boolean;
                      loansTokensSortType: LoansTokensSortType;
                      onPress: () => void;
                    }): JSX.Element {
                    mobile-app/app/screens/AppNavigator/screens/Auctions/components/AuctionsSortRow.tsx on lines 20..63

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 307.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                    export function AuctionsSortRow(props: {
                      isSorted: boolean;
                      assetSortType: AuctionsSortType;
                      onPress: () => void;
                    }): JSX.Element {
                    mobile-app/app/screens/AppNavigator/screens/Loans/components/LoansTokensSortRow.tsx on lines 22..65

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 307.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    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

                          File DexRemoveLiquidity.tsx has 450 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import { NavigationProp, useNavigation } from "@react-navigation/native";
                          import { StackScreenProps } from "@react-navigation/stack";
                          import BigNumber from "bignumber.js";
                          import { useCallback, useEffect, useMemo, useRef, useState } from "react";
                          import { Platform, View } from "react-native";

                            Function useDexStabilization has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
                            Open

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

                            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