Showing 1,971 of 13,422 total issues
Method APISuite.TestGetCountByTokenAddress
has a Cognitive Complexity of 38 (exceeds 20 allowed). Consider refactoring. Open
Open
func (g APISuite) TestGetCountByTokenAddress() {
chainID := g.chainIDs[0]
destinationChainID := g.chainIDs[1]
tokenAddressA := common.BigToAddress(big.NewInt(gofakeit.Int64()))
tokenAddressB := common.BigToAddress(big.NewInt(gofakeit.Int64()))
- 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 ClientSuite.TestParseRPCPayload
has 106 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c *ClientSuite) TestParseRPCPayload() {
/*
CHECK BLOCKS
*/
Method GuardSuite.TestFraudulentStateInSnapshot
has 106 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (g *GuardSuite) TestFraudulentStateInSnapshot() {
testDone := false
defer func() {
testDone = true
}()
SwapFlashLoanRemoveLiquidity
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanRemoveLiquidity) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanTokenSwap
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanTokenSwap) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanRemoveLiquidityImbalance
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanRemoveLiquidityImbalance) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanRampA
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanRampA) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanNewAdminFee
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanNewAdminFee) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanStopRampA
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanStopRampA) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanNewSwapFee
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanNewSwapFee) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanRemoveLiquidityOne
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanRemoveLiquidityOne) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanAddLiquidity
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanAddLiquidity) GetRaw() ethTypes.Log {
return s.Raw
}
MetaSwapTokenSwapUnderlying
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s MetaSwapTokenSwapUnderlying) GetRaw() ethTypes.Log {
return s.Raw
}
SwapFlashLoanFlashLoan
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
Open
func (s SwapFlashLoanFlashLoan) GetRaw() ethTypes.Log {
return s.Raw
}
Method Guard.handleStatusUpdated
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (g Guard) handleStatusUpdated(ctx context.Context, log ethTypes.Log, chainID uint32) error {
statusUpdated, err := g.bondingManagerParser.ParseStatusUpdated(log)
if err != nil {
return fmt.Errorf("could not parse status updated: %w", err)
}
Function TestValidation
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func TestValidation(t *testing.T) {
t.Run("Valid", func(t *testing.T) {
cfg := relconfig.Config{
Chains: map[int]relconfig.ChainConfig{
1: {
Method NodeSuite.fillBlocks
has 104 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (c NodeSuite) fillBlocks(bridgeRef *testbridge.TestBridgeRef, swapRefA *testswap.TestSwapRef, swapRefB *testswap.TestSwapRef, transactOpts backends.AuthType, chainID uint32) {
// Store blocktimes for testing defillama and timestamp indexing.
for i := uint64(0); i < 13; i++ {
err := c.eventDB.StoreBlockTime(c.GetTestContext(), chainID, i, i)
Nil(c.T(), err)
Function generateTheme
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function generateTheme(theme: CustomThemeVariables = {}) {
function str2hsl(color: string) {
// TODO: Support hex short codes
if (/^#?[\da-fA-F]{6,8}$/.test(color)) {
let [r, g, b, a] = color
Function deposit
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export const deposit = async (
pool: Token,
slippageSelected: any,
slippageCustom: any,
inputAmounts: any,
Method Bot.traceCommand
has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring. Open
Open
func (b *Bot) traceCommand() *slacker.CommandDefinition {
return b.requiresSignoz(&slacker.CommandDefinition{
Command: "trace {tags} {order}",
Description: "find a transaction in signoz",
Examples: []string{
- 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"