Showing 1,971 of 13,422 total issues
Function StakeCardTitle
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const StakeCardTitle = ({
token,
poolTokens,
poolLabel,
lpTokenBalance,
- 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 WithdrawButton
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const WithdrawButton = ({ approveTxn, withdrawTxn, isApproved }) => {
const t = useTranslations('Pools.WithdrawButton')
const { chain, isConnected: isConnectedInit } = useAccount()
const { chains, switchChain } = useSwitchChain()
const { openConnectModal } = useConnectModal()
- 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 Portfolio
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
export const Portfolio = () => {
const dispatch = useAppDispatch()
const { fromChainId }: BridgeState = useBridgeState()
const {
activeTab,
- 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
Method baseChain.HeaderByTime
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *baseChain) HeaderByTime(ctx context.Context, startHeight *big.Int, targetTime time.Time) (*types.Header, error) {
// grab the MeteredEVMClient explicitly to avoid ambiguous references
client, err := newHeaderCacheClient(b, 4)
if err != nil {
return nil, fmt.Errorf("could not create header cache client: %w", err)
Function TestForkLogsReborn
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestForkLogsReborn(t *testing.T) {
t.Parallel()
testAddr := crypto.PubkeyToAddress(testKey.PublicKey)
sim := simTestBackend(testAddr)
defer sim.Close()
Function NewEVM
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func NewEVM(ctx context.Context, name string, domain config.DomainConfig, chainRPCURL string) (domains.DomainClient, error) {
underlyingClient, err := chain.NewFromURL(ctx, chainRPCURL)
if err != nil {
return nil, fmt.Errorf("could not get evm: %w", err)
}
Method Store.GetRelayableAgentStatuses
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s Store) GetRelayableAgentStatuses(ctx context.Context, chainID uint32) ([]agentTypes.AgentTree, error) {
agentTreesTableName, err := dbcommon.GetModelName(s.DB(), &AgentTree{})
if err != nil {
return nil, fmt.Errorf("failed to get agent trees table name: %w", err)
}
Method queryResolver.getAmountStatisticsAll
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r *queryResolver) getAmountStatisticsAll(ctx context.Context, typeArg model.StatisticType, chainID *int, address *string, tokenAddress *string, compositeFilters string) (*string, error) {
if typeArg == model.StatisticTypeMedianVolumeUsd || typeArg == model.StatisticTypeMeanVolumeUsd || typeArg == model.StatisticTypeMedianFeeUsd || typeArg == model.StatisticTypeMeanFeeUsd {
return nil, fmt.Errorf("cannot calculate averages or medians across all platforms")
}
var bridgeFinalSQL *string
Method IndexerSuite.TestContractBackfill
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (x *IndexerSuite) TestContractBackfill() {
// Get simulated blockchain, deploy the test contract, and set up test variables.
simulatedChain := geth.NewEmbeddedBackendForChainID(x.GetSuiteContext(), x.T(), big.NewInt(142))
simulatedClient, err := backend.DialBackend(x.GetTestContext(), simulatedChain.RPCAddress(), x.metrics)
Nil(x.T(), err)
Method BackendSuite.TestLogsInRangeWithMultipleContracts
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (b *BackendSuite) TestLogsInRangeWithMultipleContracts() {
const desiredBlockHeight = 10
var testChainHandler *testutil.TestChainHandler
var err error
Method Store.StoreLogs
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (s Store) StoreLogs(ctx context.Context, chainID uint32, logs ...types.Log) error {
var storeLogs []Log
for _, log := range logs {
var topics []sql.NullString
Function saveNewDeployment
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const saveNewDeployment = (chainName, contractAlias, potentialReceipts) => {
// No-op if artifact has already been saved
const deploymentFN = getDeploymentFN(chainName, contractAlias)
if (fs.existsSync(deploymentFN)) {
logInfo(`Deployment artifact already exists for ${contractAlias}`)
Function getRequestStatus
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const getRequestStatus = (chainName, actionName, guid) => {
const verifier = readEnv(chainName, 'VERIFIER')
if (verifier !== VERIFIER_ETHERSCAN) {
logError(`Verifier ${verifier} is not supported by this command`)
return null
Method testJaeger.StartJaegerPyroscopeUI
has 52 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (j *testJaeger) StartJaegerPyroscopeUI(ctx context.Context) *uiResource {
// can't enable if pyroscope is disabled
// TODO: add a warning here.
if core.HasEnv(internal.JaegerUIEndpoint) || !j.cfg.enablePyroscope {
return &uiResource{
Function pendingTransactionsMissingRelay
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
pendingTransactionsMissingRelay: async () => {
const query = db
.with('deposits', () => qDeposits())
.with('relays', () => qRelays())
.with('refunds', () => qRefunds())
Function _applySlippageBigInt
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const _applySlippageBigInt = (
inputValue,
slippageSelected,
slippageCustom,
add = false
Function _applySlippage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const _applySlippage = (
inputValue,
slippageSelected,
slippageCustom,
add = false
Function getBridgeStatus
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getBridgeStatus = async (
originChainId: string | number,
kappa: string
) => {
try {
Function finalizeBridgeRoute
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
async finalizeBridgeRoute(
bridgeRoute: BridgeRoute,
originDeadline?: BigNumber,
destDeadline?: BigNumber
): Promise<BridgeQuote> {
Function DeepLiquidityIcon
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function DeepLiquidityIcon() {
return (
<svg
width="24"
height="36"