DeFiCh/wallet

View on GitHub

Showing 286 of 335 total issues

File WalletTextInputV2.tsx has 256 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

    Function NoTokensLight has 128 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

    export function NoTokensLight(): 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.4016 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 CFPDetailScreen has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export function CFPDetailScreen(): JSX.Element {
        const logger = useLogger();
        const dispatch = useAppDispatch();
        const { isLight } = useThemeContext();
        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 AnalyticsProvider has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

      export function AnalyticsProvider(props: PropsWithChildren<any>) {
        const [isAnalyticsOn, setIsAnalyticsOn] = useState<string>("true");
        const [hasAnalyticsModalBeenShown, setHasAnalyticsModalBeenShown] =
          useState<string>("false");
      
      
      Severity: Minor
      Found in shared/contexts/AnalyticsProvider.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 NumberRowWithConversion has 126 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      export function NumberRowWithConversion(props: INumberRowProps): JSX.Element {
        const rhsStyle = [
          tailwind("text-sm text-right w-full"),
          props.textStyle,
          props.rhs.style,

        Function WalletTransactionCardTextInput has 126 lines of code (exceeds 100 allowed). Consider refactoring.
        Open

        >((props: WalletTextInputProps, ref: React.Ref<any>): JSX.Element => {
          const {
            title,
            titleTestID,
            valid = true,
        Severity: Major
        Found in mobile-app/app/components/WalletTransactionCardTextInput.tsx - About 2 hrs to fix

          Function EmptyVault has 124 lines of code (exceeds 100 allowed). Consider refactoring.
          Open

          export function EmptyVault(props: EmptyVaultProps): JSX.Element {
            const navigation = useNavigation<NavigationProp<LoanParamList>>();
            const { isLight } = useThemeContext();
            const [bottomSheetScreen, setBottomSheetScreen] = useState<
              BottomSheetNavScreen[]

            Function PrivacyLockContextProvider has 123 lines of code (exceeds 100 allowed). Consider refactoring.
            Open

            export function PrivacyLockContextProvider(
              props: React.PropsWithChildren<any>
            ): JSX.Element | null {
              const logger = useLogger();
              const [hasHardware, setHasHardware] = useState<boolean>(false);
            Severity: Major
            Found in mobile-app/app/contexts/LocalAuthContext.tsx - About 1 hr to fix

              Function DexScreen has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              export function DexScreen(): JSX.Element {
                const navigation = useNavigation<NavigationProp<DexParamList>>();
                const [activeTab, setActiveTab] = useState<string>(TabKey.AvailablePoolPair);
                const tokens = useSelector((state: RootState) =>
                  tokensSelector(state.wallet)
              Severity: Minor
              Found in mobile-app/app/screens/AppNavigator/screens/Dex/DexScreen.tsx - About 1 hr 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 getVaultStatusColor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getVaultStatusColor(
                status: string,
                isLight: boolean,
                isText: boolean = false
              ): 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 getVaultStatusColor has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
              Open

              export function getVaultStatusColor(
                status: string | undefined,
                isLight: boolean,
                isText: boolean = false
              ): 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 SummaryTransactionDetails has 119 lines of code (exceeds 100 allowed). Consider refactoring.
              Open

              function SummaryTransactionDetails(
                props: SummaryTransactionDetailsProps
              ): JSX.Element {
                return (
                  <View style={tailwind("mt-6")}>

                Function SummaryTitle has a Cognitive Complexity of 14 (exceeds 5 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: Minor
                Found in mobile-app/app/components/SummaryTitle.tsx - About 1 hr 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 CollateralizationRatioDisplay has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                export function CollateralizationRatioDisplay(
                  props: CollateralizationRatioDisplayProps
                ): JSX.Element {
                  const { isLight } = useThemeContext();
                  const atRiskThresholdMultiplier = 1.5;

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

                export function Button(props: ButtonProps): JSX.Element {
                  const {
                    label,
                    submittingLabel,
                    color = "primary",
                Severity: Minor
                Found in mobile-app/app/components/Button.tsx - About 1 hr 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 useApiStatus has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                export function useApiStatus(): {
                  isBlockchainDown: boolean;
                  isOceanDown: boolean;
                } {
                  const { lastSync, lastSuccessfulSync } = useSelector(
                Severity: Minor
                Found in mobile-app/app/hooks/useApiStatus.ts - About 1 hr 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 TotalPortfolio has a Cognitive Complexity of 14 (exceeds 5 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(

                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

                Consider simplifying this complex logical expression.
                Open

                    if (
                      bestPath.length === 1 &&
                      ((tokenA.displaySymbol === "DUSD" && tokenB.displaySymbol === "DFI") ||
                        (tokenA.displaySymbol === "DUSD" && tokenB.displaySymbol === "dUSDT") ||
                        (tokenA.displaySymbol === "DUSD" && tokenB.displaySymbol === "dUSDC") ||
                Severity: Critical
                Found in mobile-app/app/screens/AppNavigator/screens/Dex/hook/DexStabilization.ts - About 1 hr to fix

                  Function TokensVsUtxoFaq has 116 lines of code (exceeds 100 allowed). Consider refactoring.
                  Open

                  export function TokensVsUtxoFaq(): JSX.Element {
                    const faqContent: AccordionContent[] = [
                      {
                        title: translate("components/UtxoVsTokenFaq", "What are UTXOs?"),
                        content: [

                    Function errorMessageMapping has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function errorMessageMapping(err: string): ErrorMapping {
                      if (err === "not enough balance after combing all prevouts") {
                        return {
                          code: ErrorCodes.InsufficientUTXO,
                          message: "Insufficient UTXO DFI.",
                    Severity: Minor
                    Found in mobile-app/app/components/OceanInterface/TransactionError.tsx - About 1 hr 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

                    Severity
                    Category
                    Status
                    Source
                    Language