cyclo

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Checks cyclo complexity of code using metric

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric struct {
	// Config with weights
	Config Weights
	// contains filtered or unexported fields
}

Intermidiate state of metric

func (Metric) Finish

func (m Metric) Finish() float64

Returns final score

func (*Metric) ParseNode

func (m *Metric) ParseNode(n ast.Node)

Parses ast node and collects all of its metrics

type Weights

type Weights struct {
	// If weight
	If float64 `xml:"if"`
	// For weight
	For float64 `xml:"for"`
	// Range weight
	Rng float64 `xml:"rng"`
	// Case weight
	Case float64 `xml:"case"`
	// Boolean and weight
	And float64 `xml:"and"`
	// Boolean or weight
	Or float64 `xml:"or"`
}

Config for metric with various weights for syntactical structures

Jump to

Keyboard shortcuts

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