DeFiCh/wallet

View on GitHub

Showing 335 of 335 total issues

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

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

                <View
                  style={tailwind(
                    "flex flex-row text-right items-center justify-end"
                  )}
                >
      mobile-app/app/screens/AppNavigator/screens/Dex/DexConfirmAddLiquidity.tsx on lines 163..194

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

      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

                <View
                  style={tailwind(
                    "flex flex-row text-right items-center justify-end"
                  )}
                >
      mobile-app/app/screens/AppNavigator/screens/Dex/CompositeSwap/ConfirmCompositeSwapScreen.tsx on lines 222..253

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

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

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

        export function LoanSkeletonLoader(
          loaderProps: LoanSkeletonLoaderProps
        ): JSX.Element {
          const { isLight } = useThemeContext();
          const skeletonCols = Array.from(Array(2), (_v, i) => i + 1);
        mobile-app/app/components/skeletonLoaders/LoanSkeletonLoaderV2.tsx on lines 41..67

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

        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 LoanSkeletonLoaderV2(
          loaderProps: LoanSkeletonLoaderProps
        ): JSX.Element {
          const { isLight } = useThemeContext();
          const skeletonCols = Array.from(Array(2), (_v, i) => i + 1);
        mobile-app/app/components/skeletonLoaders/LoanSkeletonLoader.tsx on lines 41..64

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

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

          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

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

                  <View style={tailwind("flex-row flex-1 justify-end")}>
                    {hasFetchedToken ? (
                      <NumberFormat
                        value={amount}
                        thousandSeparator
            mobile-app/app/screens/AppNavigator/screens/Portfolio/components/TokenBreakdownDetailsV2.tsx on lines 444..474

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

            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

                  <View style={tailwind("flex-row flex-1 justify-end")}>
                    {hasFetchedToken ? (
                      <NumberFormat
                        value={amount}
                        thousandSeparator
            mobile-app/app/screens/AppNavigator/screens/Portfolio/components/TokenBreakdownDetailsV2.tsx on lines 377..407

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

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

              export function useResultingCollateralizationRatioByCollateral({
                collateralValue,
                collateralRatio,
                minCollateralRatio,
                totalLoanAmount,

              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