Showing 86 of 86 total issues

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

<div className="flex flex-col w-max">
<Link
href={{
pathname:
userQueryProposalStatus === ListProposalsStatus.VOTING
Severity: Major
Found in src/pages/governance/_components/ProposalTable.tsx and 1 other location - About 2 hrs to fix
src/pages/governance/_components/ProposalCard.tsx on lines 240..267

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

<div className="flex flex-col w-6/12">
<Link
href={{
pathname:
userQueryProposalStatus === ListProposalsStatus.VOTING
Severity: Major
Found in src/pages/governance/_components/ProposalCard.tsx and 1 other location - About 2 hrs to fix
src/pages/governance/_components/ProposalTable.tsx on lines 213..240

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

export function VaultLink(
props: PropsWithChildren<VaultLinkProps>
): JSX.Element {
if (props.vault === undefined || props.vault.length === 0) {
return <></>;
Severity: Major
Found in src/components/commons/link/VaultLink.tsx and 1 other location - About 2 hrs to fix
src/components/commons/link/TxIdLink.tsx on lines 11..34

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

export function TxIdLink(props: PropsWithChildren<TxIdLinkProps>): JSX.Element {
if (props.txid === undefined || props.txid.length === 0) {
return <></>;
}
 
 
Severity: Major
Found in src/components/commons/link/TxIdLink.tsx and 1 other location - About 2 hrs to fix
src/components/commons/link/VaultLink.tsx on lines 10..35

Function SearchBar has a Cognitive Complexity of 16 (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

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

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

    <AdaptiveList className="w-full lg:w-1/2">
    <AdaptiveList.Row name="Decimal" testId="DfTxTokenCreate.decimal">
    {props.decimal}
    </AdaptiveList.Row>
    <AdaptiveList.Row name="Limit" testId="DfTxTokenCreate.limit">
    Severity: Major
    Found in src/pages/transactions/_components/DfTx/DfTxTokenCreate.tsx and 1 other location - About 2 hrs to fix
    src/pages/transactions/_components/DfTx/DfTxTokenUpdateAny.tsx on lines 72..93

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

    <AdaptiveList className="w-full lg:w-1/2">
    <AdaptiveList.Row name="Decimal" testId="DfTxTokenUpdateAny.decimal">
    {props.decimal}
    </AdaptiveList.Row>
    <AdaptiveList.Row name="Limit" testId="DfTxTokenUpdateAny.limit">
    src/pages/transactions/_components/DfTx/DfTxTokenCreate.tsx on lines 60..81

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

    export default function Blocks({
    blocks,
    }: InferGetServerSidePropsType<typeof getServerSideProps>): JSX.Element {
    return (
    <Container className="pt-12 pb-20">
    Severity: Major
    Found in src/pages/blocks/index.page.tsx and 1 other location - About 2 hrs to fix
    src/pages/tokens/index.page.tsx on lines 25..46

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

    export default function TokensPage({
    tokens,
    }: InferGetServerSidePropsType<typeof getServerSideProps>): JSX.Element {
    return (
    <Container className="pt-12 pb-20">
    Severity: Major
    Found in src/pages/tokens/index.page.tsx and 1 other location - About 2 hrs to fix
    src/pages/blocks/index.page.tsx on lines 24..46

    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

      Function getDuration has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getDuration(seconds: number): string {
      const { y, m, d, h, min, s } = secondsToTime(seconds);
      const yDisplay = y > 0 ? `${y}y` : "";
      const mDisplay =
      m > 0 ? ` ${y > 0 ? padStart(m.toString(), 2, "0") : m}m` : "";
      Severity: Minor
      Found in src/pages/governance/shared/durationHelper.ts - About 1 hr to fix

      Function ProposalRow has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      function ProposalRow({
      proposal,
      votes,
      currentBlockHeight,
      currentBlockMedianTime,
      Severity: Minor
      Found in src/pages/governance/_components/ProposalTable.tsx - About 1 hr to fix

      Function ProposalCard has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      function ProposalCard({
      proposal,
      votes,
      currentBlockHeight,
      currentBlockMedianTime,
      Severity: Minor
      Found in src/pages/governance/_components/ProposalCard.tsx - About 1 hr to fix

      Function findPath has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

      export function findPath(
      graph: GraphProps[],
      origin: string,
      target: string
      ): { visitedNodes: Set<string>; path: string[] } {
      Severity: Minor
      Found in src/pages/vaults/utils/path-finding.tsx - About 1 hr to fix

      Function AddressSummaryTable has 118 lines of code (exceeds 100 allowed). Consider refactoring.
      Open

      export function AddressSummaryTable(
      props: AddressSummaryTableProps
      ): JSX.Element {
      const api = useWhaleApiClient();
      const { connection } = useNetwork();
      Severity: Major
      Found in src/pages/address/_components/AddressSummaryTable.tsx - About 1 hr to fix

        Function SupplyStats has 117 lines of code (exceeds 100 allowed). Consider refactoring.
        Open

        export function SupplyStats(): JSX.Element {
        const apiClient = useWhaleApiClient();
         
        const [data, setData] = useState<SupplyStatsStateI>({
        stats: null,
        Severity: Major
        Found in src/components/index/SupplyStats.tsx - About 1 hr to fix

          Function PricesPage has 115 lines of code (exceeds 100 allowed). Consider refactoring.
          Open

          export default function PricesPage(
          props: InferGetServerSidePropsType<typeof getServerSideProps>
          ): JSX.Element {
          const types = ["All", "Crypto", "Stocks", "Forex", "Commodity", "ETF"];
           
           
          Severity: Major
          Found in src/pages/oracles/index.page.tsx - About 1 hr to fix

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

            async function getSearchResults(
            api: WhaleApiClient,
            network: NetworkName,
            query: string,
            ): Promise<SearchResult[]> {
            Severity: Minor
            Found in src/components/commons/searchbar/SearchBar.tsx - About 1 hr to fix

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

            function UpdateOracleTableRow(props: { priceFeed: CurrencyPair }): JSX.Element {
            return (
            <OverflowTable.Row>
            <OverflowTable.Cell>
            <span data-testid={`DfTxUpdateOracle.${props.priceFeed.token}Token`}>
            src/pages/transactions/_components/DfTx/DfTxAppointOracle.tsx on lines 66..85
            Severity
            Category
            Status
            Source
            Language