botkube icon indicating copy to clipboard operation
botkube copied to clipboard

Decrease cyclomatic complexity of main function

Open huseyinbabal opened this issue 2 years ago • 0 comments

Description

Since the main.go is too big, linter check fails due to cyclomatic complexity as shown below.

WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
cmd/botkube/main.go:59:1: cyclomatic complexity 31 of func `run` is high (> 30) (gocyclo)
func run() error {
^

Expected behavior

Linter check should succeed

Actual behavior

It fails due to the cyclomatic complexity threshold

Steps to reproduce

The threshold is increased to 35, it can be reproduced by setting it to 30 which is default value and run make lint-fix.

huseyinbabal avatar Sep 21 '22 08:09 huseyinbabal