synapsecns/sanguine

View on GitHub
contrib/opbot/botmd/commands.go

Summary

Maintainability
D
2 days
Test Coverage

Method Bot.rfqRefund has a Cognitive Complexity of 65 (exceeds 20 allowed). Consider refactoring.
Open

func (b *Bot) rfqRefund() *slacker.CommandDefinition {
    return &slacker.CommandDefinition{
        Command:     "refund <tx>",
        Description: "refund a quote request",
        Examples:    []string{"refund 0x1234"},
Severity: Minor
Found in contrib/opbot/botmd/commands.go - About 7 hrs to fix

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

func (b *Bot) rfqRefund() *slacker.CommandDefinition {
    return &slacker.CommandDefinition{
        Command:     "refund <tx>",
        Description: "refund a quote request",
        Examples:    []string{"refund 0x1234"},
Severity: Major
Found in contrib/opbot/botmd/commands.go - About 3 hrs to fix

    Method Bot.traceCommand has a Cognitive Complexity of 37 (exceeds 20 allowed). Consider refactoring.
    Open

    func (b *Bot) traceCommand() *slacker.CommandDefinition {
        return b.requiresSignoz(&slacker.CommandDefinition{
            Command:     "trace {tags} {order}",
            Description: "find a transaction in signoz",
            Examples: []string{
    Severity: Minor
    Found in contrib/opbot/botmd/commands.go - About 3 hrs to fix

    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

    func (b *Bot) traceCommand() *slacker.CommandDefinition {
        return b.requiresSignoz(&slacker.CommandDefinition{
            Command:     "trace {tags} {order}",
            Description: "find a transaction in signoz",
            Examples: []string{
    Severity: Major
    Found in contrib/opbot/botmd/commands.go - About 2 hrs to fix

      Method Bot.rfqLookupCommand has 58 lines of code (exceeds 50 allowed). Consider refactoring.
      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{
      Severity: Minor
      Found in contrib/opbot/botmd/commands.go - About 1 hr to fix

        Method Bot.makeFastBridge has 6 return statements (exceeds 4 allowed).
        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)
            }
        Severity: Major
        Found in contrib/opbot/botmd/commands.go - About 40 mins to fix

          There are no issues that match your filters.

          Category
          Status