gocognito

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 6 Imported by: 0

README

Gocognito

Gocognito calculates cognitive complexities of functions in Go source files. Intutive difficulty for programmers is reflected in cognitive complexity.

Installation

go install github.com/nrnrk/gocognito/cmd/gocognito@latest

Usage

$ gocognito
gocognito: Calculate cognitive complexity of functions.

Usage: gocognito [-flag] [package]

The gocognito analysis reports functions whose complexity is over than the specified limit.
...

Examples:

gocognit .
gocognit main.go
gocognit -over 10 ./pkg/...
  • Gocognit where the codes are based on.

Documentation

Overview

Package gocognito defines Analyzer to checks and calculate the complexity of function based on "cognitive complexity" methods.

Index

Constants

View Source
const Doc = `` /* 137-byte string literal not displayed */

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "gocognito",
	Doc:      Doc,
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Functions

func Complexity

func Complexity(fn *ast.FuncDecl) int

Complexity calculates the cognitive complexity of a function.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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