Showing 27 of 95 total issues
Function RebalanceModal
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export function RebalanceModal({
groupedPosition,
isOpen,
onClose,
refetch,
- 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 PositionsSummaryTable
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
export function PositionsSummaryTable({
marketPositions,
setShowModal,
setSelectedPosition,
refetch,
- 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 Markets
has 147 lines of code (exceeds 80 allowed). Consider refactoring. Open
export default function Markets() {
const { loading, data: rawMarkets } = useMarkets();
// token keys, aggregated with | for each "ERC20Token" object
const [selectedCollaterals, setSelectedCollaterals] = useState<string[]>([]);
File FromAndToMarkets.tsx
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import { Input } from '@nextui-org/react';
import { Pagination } from '@nextui-org/react';
import Image from 'next/image';
import { formatUnits } from 'viem';
Function InfoPage
has 141 lines of code (exceeds 80 allowed). Consider refactoring. Open
function InfoPage() {
const [currentSection, setCurrentSection] = useState(0);
const [isClient, setIsClient] = useState(false);
const containerRef = useRef<HTMLDivElement>(null);
const [isTransitioning, setIsTransitioning] = useState(false);
File types.ts
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
export type MarketPosition = {
supplyShares: string;
supplyAssets: string;
supplyAssetsUsd: number;
borrowShares: string;
File PositionsSummaryTable.tsx
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useMemo, useState, useEffect } from 'react';
import { Spinner } from '@nextui-org/react';
import { ChevronDownIcon, ChevronUpIcon } from '@radix-ui/react-icons';
import Image from 'next/image';
import { GrRefresh } from 'react-icons/gr';
File RebalanceModal.tsx
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React, { useState, useMemo, useCallback } from 'react';
import {
Modal,
ModalContent,
ModalHeader,
Function Input
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export default function Input({
decimals,
max,
setValue,
setError,
- 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 useUserPositions
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const useUserPositions = (user: string | undefined) => {
const [loading, setLoading] = useState(true);
const [isRefetching, setIsRefetching] = useState(false);
const [data, setData] = useState<MarketPosition[]>([]);
const [history, setHistory] = useState<UserTransaction[]>([]);
- 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 InfoPage
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
function InfoPage() {
const [currentSection, setCurrentSection] = useState(0);
const [isClient, setIsClient] = useState(false);
const containerRef = useRef<HTMLDivElement>(null);
const [isTransitioning, setIsTransitioning] = useState(false);
- 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 WithdrawModal
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function WithdrawModal({ position, onClose, refetch }: ModalProps): JSX.Element {
// Add state for the supply amount
const [inputError, setInputError] = useState<string | null>(null);
const [withdrawAmount, setWithdrawAmount] = useState<bigint>(BigInt(0));
- 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 useUserPositions
has 84 lines of code (exceeds 80 allowed). Consider refactoring. Open
const useUserPositions = (user: string | undefined) => {
const [loading, setLoading] = useState(true);
const [isRefetching, setIsRefetching] = useState(false);
const [data, setData] = useState<MarketPosition[]>([]);
const [history, setHistory] = useState<UserTransaction[]>([]);
Function AssetFilter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export default function AssetFilter({
label,
placeholder,
selectedAssets,
setSelectedAssets,
- 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 useMarkets
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const useMarkets = () => {
const [loading, setLoading] = useState(true);
const [isRefetching, setIsRefetching] = useState(false);
const [data, setData] = useState<Market[]>([]);
const [error, setError] = useState<unknown | null>(null);
- 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 useMarkets
has 82 lines of code (exceeds 80 allowed). Consider refactoring. Open
const useMarkets = () => {
const [loading, setLoading] = useState(true);
const [isRefetching, setIsRefetching] = useState(false);
const [data, setData] = useState<Market[]>([]);
const [error, setError] = useState<unknown | null>(null);
Function Rewards
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export default function Rewards() {
const { account } = useParams<{ account: string }>();
const [activeProgram, setActiveProgram] = useState<'market' | 'uniform'>('market');
const { loading, data: markets } = useMarkets();
- 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 useAllowance
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function useAllowance({
user,
spender,
chainId = 1,
token,
- 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 Button
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function Button({
buttonContent,
type = 'button',
className,
onClick,
- 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 OracleVendorBadge
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function OracleVendorBadge({ oracleData, useTooltip = true }: OracleVendorBadgeProps) {
const { vendors } = parseOracleVendors(oracleData);
const noFeeds = vendors.length === 0;
- 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"