Closed paocalvi closed 2 years ago
I don't see this in the scope for this project. Gocyclo is only concerned with cyclomatic complexity / the McCabe metric, which is defined as the maximum number of linearly independent paths of a function, and also specifies the minimum number of test cases required to cover every path of a function. Error paths should be part of that. Rather than make up a new metric you could adjust the limit for your code style.
Not just an issue, but it would be nice to have a switch to avoid counting constructs clearly related to mere error checking and returning, for example IF block with less that 3/4 lines testing just err != nil could be not counted in complexity. ES: if err != nil { log....... return nil,err // or return fmt.Errorf("sfsdfsdf %w", err) }