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

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

                                      <div className="flex flex-row">
                                        <div className="flex flex-col grow">
                                          <span
                                            className={classNames(
                                              percYes > percNo
                        Severity: Major
                        Found in src/pages/governance/_components/VotingResult.tsx and 1 other location - About 3 hrs to fix
                        src/pages/governance/_components/VotingResult.tsx on lines 309..350

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

                        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

                                        <div className="flex flex-row">
                                          <div className="flex flex-col grow">
                                            <span
                                              className={classNames(
                                                percYes > percNo
                        Severity: Major
                        Found in src/pages/governance/_components/VotingResult.tsx and 1 other location - About 3 hrs to fix
                        src/pages/governance/_components/VotingResult.tsx on lines 123..164

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

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

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

                                  <div className="w-full lg:w-1/2">
                                    {props.dftx.data.to.map((scriptBalances) => {
                                      const scriptToAddress =
                                        fromScript(scriptBalances.script, network)?.address ?? "N/A";
                                      return (
                          src/pages/transactions/_components/DfTx/DfTxAnyAccountToAccount.tsx on lines 23..47

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

                          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

                                  <div className="w-full lg:w-1/2">
                                    {props.dftx.data.from.map((scriptBalances) => {
                                      const scriptFromAddress =
                                        fromScript(scriptBalances.script, network)?.address ?? "N/A";
                                      return (
                          src/pages/transactions/_components/DfTx/DfTxAnyAccountToAccount.tsx on lines 48..71

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

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