Skip to content
forked from fzipp/gocyclo

Calculate cyclomatic complexities of functions in Go source code. This version can ignore error handling.

License

Notifications You must be signed in to change notification settings

robgeurden/gocyclo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gocyclo calculates cyclomatic complexities of functions in Go source code. This version has the option to ignore error handling due to the error handling syntax in Go.

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 '||'
when noerror flag is set if err != nil will be ignored

To install, run

$ go get github.com/rgeurden/gocyclo

and put the resulting binary in one of your PATH directories if $GOPATH/bin isn't already in your PATH.

Usage:

$ gocyclo [<flag> ...] <Go file or directory> ...

Examples:

$ gocyclo .
$ gocyclo main.go
$ gocyclo -top 10 src/
$ gocyclo -over 25 docker
$ gocyclo -avg .
$ gocyclo -noerror .

The output fields for each line are:

<complexity> <package> <function> <file:row:column>

About

Calculate cyclomatic complexities of functions in Go source code. This version can ignore error handling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%