contrib/opbot/botmd/commands.go
Method Bot.rfqRefund
has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring. Open
Open
func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return &slacker.CommandDefinition{
Command: "refund <tx>",
Description: "refund a quote request",
Examples: []string{"refund 0x1234"},
- 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 Bot.rfqRefund
has 123 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (b *Bot) rfqRefund() *slacker.CommandDefinition {
return &slacker.CommandDefinition{
Command: "refund <tx>",
Description: "refund a quote request",
Examples: []string{"refund 0x1234"},
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"
Further reading
Method Bot.traceCommand
has 90 lines of code (exceeds 50 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{
Method Bot.rfqLookupCommand
has 58 lines of code (exceeds 50 allowed). Consider refactoring. Open
Open
func (b *Bot) rfqLookupCommand() *slacker.CommandDefinition {
return &slacker.CommandDefinition{
Command: "rfq <tx>",
Description: "find a rfq transaction by either tx hash or txid from the rfq-indexer api",
Examples: []string{
Method Bot.makeFastBridge
has 6 return statements (exceeds 4 allowed). Open
Open
func (b *Bot) makeFastBridge(ctx context.Context, chainID uint32) (*fastbridge.FastBridge, error) {
client, err := rfqClient.NewUnauthenticatedClient(b.handler, b.cfg.RFQApiURL)
if err != nil {
return nil, fmt.Errorf("error creating rfq client: %w", err)
}