Showing 72 of 88 total issues

Function CreateProposalPage has 406 lines of code (exceeds 100 allowed). Consider refactoring.
Open

export default function CreateProposalPage() {
  const { connection } = useNetwork();
  const [activeStep, setActiveStep] = useState(1);
  const [title, setTitle] = useState<string>("");
  const [proposalType, setProposalType] = useState(
Severity: Major
Found in src/pages/governance/create/index.page.tsx - About 1 day to fix

    File ConfirmVoteDialog.tsx has 626 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, {
      useState,
      Dispatch,
      SetStateAction,
      useRef,
    Severity: Major
    Found in src/pages/governance/_components/ConfirmVoteDialog.tsx - About 1 day to fix

      File VotingResult.tsx has 580 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Dispatch, SetStateAction } from "react";
      import BigNumber from "bignumber.js";
      import classNames from "classnames";
      import { NumericFormat } from "react-number-format";
      import { VoteDecision } from "@defichain/jellyfish-api-core/dist/category/governance";
      Severity: Major
      Found in src/pages/governance/_components/VotingResult.tsx - About 1 day to fix

        File Header.tsx has 573 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { Link } from "@components/commons/link/Link";
        import { IoChevronDown } from "react-icons/io5";
        import { DeFiChainLogo } from "@components/icons/DeFiChainLogo";
        import classNames from "classnames";
        import { useRouter } from "next/router";
        Severity: Major
        Found in src/layouts/components/Header.tsx - About 1 day to fix

          File index.ts has 501 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* eslint @typescript-eslint/quotes: 0 */
          
          export interface PriceCopy {
            /**
             * @example 'TSLA-USD'
          Severity: Major
          Found in content/prices/index.ts - About 1 day to fix

            File index.page.tsx has 454 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React from "react";
            import { Container } from "@components/commons/Container";
            import { ApiPagedResponse } from "@defichain/whale-api-client";
            import {
              CursorPage,
            Severity: Minor
            Found in src/pages/governance/index.page.tsx - About 6 hrs to fix

              File index.page.tsx has 436 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { useEffect, useState } from "react";
              import { Container } from "@components/commons/Container";
              import { Head } from "@components/commons/Head";
              import {
                MdRemove,
              Severity: Minor
              Found in src/pages/governance/create/index.page.tsx - About 6 hrs to fix

                File [id].page.tsx has 419 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import { AdaptiveList } from "@components/commons/AdaptiveList";
                import { Breadcrumb } from "@components/commons/Breadcrumb";
                import { getAssetIcon, getTokenIcon } from "@components/icons/assets/tokens";
                import { getWhaleApiClient, useWhaleApiClient } from "@contexts/WhaleContext";
                import { TokenData } from "@defichain/whale-api-client/dist/api/tokens";
                Severity: Minor
                Found in src/pages/tokens/[id].page.tsx - About 6 hrs to fix

                  Function CreateProposalPage has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export default function CreateProposalPage() {
                    const { connection } = useNetwork();
                    const [activeStep, setActiveStep] = useState(1);
                    const [title, setTitle] = useState<string>("");
                    const [proposalType, setProposalType] = useState(
                  Severity: Minor
                  Found in src/pages/governance/create/index.page.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

                  File OracleGraph.tsx has 357 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import { JSX } from "@babel/types";
                  import { useWhaleApiClient } from "@contexts/WhaleContext";
                  import { WhaleApiClient } from "@defichain/whale-api-client";
                  import {
                    PriceFeedInterval,
                  Severity: Minor
                  Found in src/pages/oracles/_components/OracleGraph.tsx - About 4 hrs to fix

                    File index.page.tsx has 354 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { Dispatch, SetStateAction, useEffect, useState } from "react";
                    import { Container } from "@components/commons/Container";
                    import { getWhaleApiClient } from "@contexts/WhaleContext";
                    import { GetServerSidePropsContext, InferGetServerSidePropsType } from "next";
                    import {
                    Severity: Minor
                    Found in src/pages/governance/[proposalId]/index.page.tsx - About 4 hrs to fix

                      File Footer.tsx has 321 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { Link } from "@components/commons/link/Link";
                      import { DeFiChainLogo } from "@components/icons/DeFiChainLogo";
                      import { PropsWithChildren } from "react";
                      import {
                        FaDiscord,
                      Severity: Minor
                      Found in src/layouts/components/Footer.tsx - About 3 hrs to fix

                        File ProposalTable.tsx has 297 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import React, { useState } from "react";
                        import { useRouter } from "next/router";
                        import { OverflowTable } from "@components/commons/OverflowTable";
                        import { AiFillGithub, AiFillRedditCircle } from "react-icons/ai";
                        import classNames from "classnames";
                        Severity: Minor
                        Found in src/pages/governance/_components/ProposalTable.tsx - About 3 hrs to fix

                          File ProposalCard.tsx has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import React, { useState } from "react";
                          import classNames from "classnames";
                          import { AiFillGithub, AiFillRedditCircle } from "react-icons/ai";
                          import {
                            MdOutlineKeyboardArrowUp,
                          Severity: Minor
                          Found in src/pages/governance/_components/ProposalCard.tsx - About 2 hrs to fix

                            Function Header has 140 lines of code (exceeds 100 allowed). Consider refactoring.
                            Open

                            export function Header(): JSX.Element {
                              const [menu, setMenu] = useState(false);
                              const [atTop, setAtTop] = useState(true);
                              const [isSearchIconClicked, setIsSearchIconClicked] = useState(false);
                              const [openProposalsLength, setOpenProposalsLength] = useState<
                            Severity: Major
                            Found in src/layouts/components/Header.tsx - About 2 hrs to fix

                              Function SearchBar has 136 lines of code (exceeds 100 allowed). Consider refactoring.
                              Open

                              export function SearchBar(props: SearchBarInterface): JSX.Element {
                                const api = useWhaleApiClient();
                                const { name: network, connection } = useNetwork();
                                const router = useRouter();
                              
                              
                              Severity: Major
                              Found in src/components/commons/searchbar/SearchBar.tsx - About 2 hrs to fix

                                Function SearchBar has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export function SearchBar(props: SearchBarInterface): JSX.Element {
                                  const api = useWhaleApiClient();
                                  const { name: network, connection } = useNetwork();
                                  const router = useRouter();
                                
                                
                                Severity: Minor
                                Found in src/components/commons/searchbar/SearchBar.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 useApiStatus has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export function useApiStatus(): {
                                  isBlockchainDown: boolean;
                                  isOceanDown: boolean;
                                } {
                                  const { lastSync, lastSuccessfulSync } = useSelector(
                                Severity: Minor
                                Found in src/hooks/useApiStatus.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

                                File VaultIdLoansDetails.tsx has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import {
                                  LoanVaultState,
                                  LoanVaultTokenAmount,
                                } from "@defichain/whale-api-client/dist/api/loan";
                                import { getAssetIcon } from "@components/icons/assets/tokens";
                                Severity: Minor
                                Found in src/pages/vaults/[vaultid]/_components/VaultIdLoansDetails.tsx - About 2 hrs to fix

                                  Function VaultHealthBar has 120 lines of code (exceeds 100 allowed). Consider refactoring.
                                  Open

                                  export function VaultHealthBar(props: VaultHealthBarProps): JSX.Element {
                                    const atRiskThresholdMultiplier = 1.5;
                                    const minColRatio = new BigNumber(props.vault.loanScheme.minColRatio);
                                    const maxRatio = getMaxRatio(
                                      minColRatio.multipliedBy(atRiskThresholdMultiplier)
                                  Severity: Major
                                  Found in src/pages/vaults/_components/commons/VaultHealthBar.tsx - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language