Skip to content

Reduce cyclomatic complexity in handler.match() (handlers.go, line 43) #221

@steindvart

Description

@steindvart

Problem

Static analyzer gocyclo reports that the cyclomatic complexity of the function handler.match() in handlers.go at line 43 is 23, which is higher than the recommended maximum of 15.

Proposal

Refactor the handler.match() function to reduce its cyclomatic complexity to 15 or less. This may involve splitting up the function into smaller logical parts.

Arguments

  • High cyclomatic complexity makes the code harder to read, test, and maintain.
  • Refactoring will help future contributors understand the logic more easily.
  • Lower complexity will improve code quality and help pass static analysis checks.

Static analysis warning (https://goreportcard.com/report/github.com/go-telegram/bot):

handlers.go
Line 43: warning: cyclomatic complexity 23 of function (handler).match() is high (> 15) (gocyclo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions