Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gocyclo to CI checks #1865

Open
0pcom opened this issue Sep 1, 2024 · 0 comments
Open

add gocyclo to CI checks #1865

0pcom opened this issue Sep 1, 2024 · 0 comments

Comments

@0pcom
Copy link
Collaborator

0pcom commented Sep 1, 2024

The go report card for skywire shows 100% in every category except gocyclo

It would be worthwhile to include the results of the gocyclo checks in the CI pipeline ; with additional makefile directive which corresponds to it's use.

The current gocyclo results are as follows:

gocyclo 96%

Gocyclo calculates cyclomatic complexities of functions in Go source code. The cyclomatic complexity of a function is calculated according to the following rules: 1 is the base complexity of a function +1 for each 'if', 'for', 'case', '&&' or '||' Go Report Card warns on functions with cyclomatic complexity > 15.

cmd/skywire-cli/commands/visor/top.go
Line 229: warning: cyclomatic complexity 64 of function eventLoop() is high (> 15) (gocyclo)
Line 94: warning: cyclomatic complexity 23 of function parseArgs() is high (> 15) (gocyclo)
Line 411: warning: cyclomatic complexity 16 of function run() is high (> 15) (gocyclo)
pkg/visor/hypervisor.go
Line 624: warning: cyclomatic complexity 38 of function (*Hypervisor).putApp() is high (> 15) (gocyclo)
pkg/visor/init.go
Line 890: warning: cyclomatic complexity 17 of function getRouteSetupHooks() is high (> 15) (gocyclo)
Line 1411: warning: cyclomatic complexity 16 of function initDmsgpty() is high (> 15) (gocyclo)
cmd/skywire-cli/commands/rewards/ui.go
Line 241: warning: cyclomatic complexity 114 of function server() is high (> 15) (gocyclo)
cmd/skywire-cli/commands/log/st.go
Line 48: warning: cyclomatic complexity 42 of function makeTree() is high (> 15) (gocyclo)
pkg/visor/visorconfig/config.go
Line 143: warning: cyclomatic complexity 20 of function MakeDefaultConfig() is high (> 15) (gocyclo)
internal/vpn/client.go
Line 345: warning: cyclomatic complexity 19 of function (*Client).serveConn() is high (> 15) (gocyclo)
pkg/visor/cmd.go
Line 60: warning: cyclomatic complexity 19 of function init() is high (> 15) (gocyclo)
pkg/router/router.go
Line 487: warning: cyclomatic complexity 16 of function (*router).saveRouteGroupRules() is high (> 15) (gocyclo)

Actionability

the results of the gocyclo test indicates areas where the code may be improved to reduce overall cyclomatic complexities of functions. They should not be considered breaking errors, but the results of these tests should be more visible in the CI pipeline so that they may be addressed in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant