ipfs-search/ipfs-search

View on GitHub
components/queue/amqp/connection.go

Summary

Maintainability
A
0 mins
Test Coverage

Function NewConnection has 55 lines of code (exceeds 50 allowed). Consider refactoring.
Wontfix

func NewConnection(ctx context.Context, cfg *Config, amqpConfig *amqp.Config, i *instr.Instrumentation) (*Connection, error) {
    ctx, span := i.Tracer.Start(ctx, "queue.amqp.NewConnection", trace.WithAttributes(attribute.String("amqp_url", cfg.URL)))
    defer span.End()

    amqpConn, err := amqp.DialConfig(cfg.URL, *amqpConfig)
Severity: Minor
Found in components/queue/amqp/connection.go - About 1 hr to fix

    Function NewConnection has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring.
    Wontfix

    func NewConnection(ctx context.Context, cfg *Config, amqpConfig *amqp.Config, i *instr.Instrumentation) (*Connection, error) {
        ctx, span := i.Tracer.Start(ctx, "queue.amqp.NewConnection", trace.WithAttributes(attribute.String("amqp_url", cfg.URL)))
        defer span.End()
    
        amqpConn, err := amqp.DialConfig(cfg.URL, *amqpConfig)
    Severity: Minor
    Found in components/queue/amqp/connection.go - About 25 mins 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

    TODO found
    Wontfix

                            // TODO: Proper error propagation/recovery
    Severity: Minor
    Found in components/queue/amqp/connection.go by fixme

    There are no issues that match your filters.

    Category
    Status