Showing 1,971 of 13,422 total issues
Function getFromTokens
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const getFromTokens = ({
fromChainId,
fromTokenRouteSymbol,
toChainId,
toTokenRouteSymbol,
- 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 getToChainIds
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const getToChainIds = ({
fromChainId,
fromTokenRouteSymbol,
toChainId,
toTokenRouteSymbol,
- 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 approve
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export const approve = async (
pool: Token,
depositQuote: any,
inputValue: Record<string, bigint>,
chainId: number
- 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 ListenerTestSuite.TestListenForEvents
has 85 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (l *ListenerTestSuite) TestListenForEvents() {
_, handle := l.manager.GetCounter(l.GetTestContext(), l.backend)
var wg sync.WaitGroup
const iterations = 10
for i := 0; i < iterations; i++ {
Method Resolver.bwDestinationFallback
has 85 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (r Resolver) bwDestinationFallback(ctx context.Context, chainID uint32, address string, identifier string, timestamp int, historical bool, bridgeType model.BridgeType) (*model.BridgeWatcherTx, error) {
txFetchContext, cancelTxFetch := context.WithTimeout(ctx, maxTimeToWaitForTx)
defer cancelTxFetch()
b := &backoff.Backoff{
Function GetDefiLlamaData
has 85 lines of code (exceeds 50 allowed). Consider refactoring. Open
func GetDefiLlamaData(ctx context.Context, timestamp int, coinGeckoID string) *float64 {
zero := float64(0)
if coinGeckoID == "NO_TOKEN" || coinGeckoID == "NO_PRICE" {
// if there is no data on the token, the amount returned will be 1:1 (price will be same as the amount of token
Method queryResolver.BridgeTransactions
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *queryResolver) BridgeTransactions(ctx context.Context, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txnHash *string, kappa *string, pending *bool, useMv *bool, page *int, tokenAddressFrom []*string, tokenAddressTo []*string, onlyCctp *bool) ([]*model.BridgeTransaction, error) {
Method Client.GetBridgeTransactions
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
func (c *Client) GetBridgeTransactions(ctx context.Context, chainIDTo []*int, chainIDFrom []*int, addressTo *string, addressFrom *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, kappa *string, pending *bool, page *int, tokenAddressFrom []*string, tokenAddressTo []*string, useMv *bool, httpRequestOptions ...client.HTTPRequestOption) (*GetBridgeTransactions, error) {
Method queryResolver.GetBridgeTxsFromDestination
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
func (r *queryResolver) GetBridgeTxsFromDestination(ctx context.Context, useMv *bool, chainIDFrom []*int, chainIDTo []*int, addressFrom *string, addressTo *string, maxAmount *int, minAmount *int, maxAmountUsd *int, minAmountUsd *int, startTime *int, endTime *int, txHash *string, kappa *string, tokenAddressFrom []*string, tokenAddressTo []*string, onlyCctp *bool, page *int, pending *bool) ([]*model.BridgeTransaction, error) {
Function TestEncodeSnapshotParity
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func TestEncodeSnapshotParity(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
defer cancel()
testBackend := simulated.NewSimulatedBackend(ctx, t)
Method executionContext.field_Query_messageBusTransactions_args
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_messageBusTransactions_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 []*int
if tmp, ok := rawArgs["chainID"]; ok {
Method executionContext.field_Query_logs_args
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_logs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 *string
if tmp, ok := rawArgs["contract_address"]; ok {
Method executionContext.field_Query_transactionsAtHeadRange_args
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_transactionsAtHeadRange_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 *string
if tmp, ok := rawArgs["tx_hash"]; ok {
Method executionContext.field_Query_logs_args
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_logs_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 *string
if tmp, ok := rawArgs["contract_address"]; ok {
Method executionContext.field_Query_transactionsAtHeadRange_args
has 84 lines of code (exceeds 50 allowed). Consider refactoring. Open
func (ec *executionContext) field_Query_transactionsAtHeadRange_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {
var err error
args := map[string]interface{}{}
var arg0 *string
if tmp, ok := rawArgs["tx_hash"]; ok {
Function setSwapFromToken
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
setSwapFromToken: (state, action: PayloadAction<Token>) => {
const incomingFromToken = action.payload
const validFromChainIds = getSwapFromChainIds({
fromChainId: state.swapChainId ?? null,
Function setSwapToToken
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
setSwapToToken: (state, action: PayloadAction<Token>) => {
const incomingToToken = action.payload
const validFromChainIds = getSwapFromChainIds({
fromChainId: state.swapChainId ?? null,
Function getTransactionById
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const getTransactionById = async (req: Request, res: Response) => {
const { transactionId } = req.params
try {
const query = db
File reducer.ts
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { DAI, USDC } from '@/constants/tokens/bridgeable'
import { EMPTY_SWAP_QUOTE } from '@/constants/swap'
File getSwapFromChainIds.ts
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
import _ from 'lodash'
import {
EXISTING_SWAP_ROUTES,
SWAP_CHAIN_IDS,