cyclo

package
v0.0.0-...-cd0bcf6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

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>

Documentation

Overview

Gocyclo calculates the cyclomatic complexities of functions and methods in Go source code.

Usage:

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

Flags

-over N   show functions with complexity > N only and
          return exit code 1 if the output is non-empty
-top N    show the top N most complex functions only
-avg      show the average complexity

The output fields for each line are: <complexity> <package> <function> <file:row:column>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cyclo

func Cyclo(packagePath string) ([]string, string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL