Clever/gocyclo

Name: gocyclo

Owner: Clever

Description: Calculate cyclomatic complexities of functions in Go source code.

Forked from: fzipp/gocyclo

Created: 2017-02-09 00:23:08.0

Updated: 2017-02-09 00:23:10.0

Pushed: 2017-02-09 00:36:29.0

Homepage: null

Size: 9

Language: Go

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

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 '||'

To install, run

$ go get github.com/fzipp/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 .

The output fields for each line are:

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

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.