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(
File ConfirmVoteDialog.tsx
has 626 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, {
useState,
Dispatch,
SetStateAction,
useRef,
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";
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";
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'
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,
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,
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";
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(
- Read upRead up
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,
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 {
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,
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";
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,
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<
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();
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();
- Read upRead up
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(
- Read upRead up
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";
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)