DeFiCh/wallet

View on GitHub

Showing 335 of 335 total issues

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

      <ThemedViewV2
        style={tailwind("p-5 rounded-lg-v2")}
        light={tailwind("bg-mono-light-v2-00")}
        dark={tailwind("bg-mono-dark-v2-00")}
      >
mobile-app/app/screens/AppNavigator/screens/Settings/screens/NetworkSelectionScreen.tsx on lines 84..125

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

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

      <ThemedViewV2
        style={tailwind("p-5 rounded-lg-v2")}
        light={tailwind("bg-mono-light-v2-00")}
        dark={tailwind("bg-mono-dark-v2-00")}
      >
mobile-app/app/screens/WalletNavigator/screens/CreateWallet/OnboardingNetworkSelectScreen.tsx on lines 64..105

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

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

export function VaultCard(props: VaultCardProps): JSX.Element {
  const navigation = useNavigation<NavigationProp<LoanParamList>>();
  const vault = props.vault as LoanVaultActive;
  const vaultState = useVaultStatus(
    vault.state,

    File Vaults.tsx has 337 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { tailwind } from "@tailwind";
    import {
      ThemedIcon,
      ThemedScrollViewV2,
      ThemedTextV2,

      Function AddLiquidityScreen has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      export function AddLiquidityScreen(props: Props): JSX.Element {
        const logger = useLogger();
        const navigation = useNavigation<NavigationProp<DexParamList>>();
        const dispatch = useAppDispatch();
        const DFIToken = useSelector((state: RootState) =>
      Severity: Minor
      Found in mobile-app/app/screens/AppNavigator/screens/Dex/DexAddLiquidity.tsx - About 4 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 SendScreen has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

      export function SendScreen({ route, navigation }: Props): JSX.Element {
        const dispatch = useAppDispatch();
        const logger = useLogger();
        const { isEvmFeatureEnabled } = useDomainContext();
        const { networkName } = 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 PlaygroundWallet has 177 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      export function PlaygroundWallet(): JSX.Element | null {
        const { wallets, clearWallets, setWallet } = useWalletPersistenceContext();
        const { network, updateNetwork } = useNetworkContext();
      
        const dataLists = [

        File DexStabilization.ts has 333 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { AnnouncementData } from "@waveshq/walletkit-core";
        import { useLanguageContext } from "@shared-contexts/LanguageProvider";
        import { nativeApplicationVersion } from "expo-application";
        import { useCallback, useState } from "react";
        import { useTokenBestPath } from "@screens/AppNavigator/screens/Portfolio/hooks/TokenBestPath";

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