wmfp

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: 7 Imported by: 0

Documentation

Overview

Package with wmfp(https://en.wikipedia.org/wiki/Weighted_Micro_Function_Points) metric calculator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Cyclo complexity weights
	CycloComp cyclo.Weights `xml:"cyclomatic"`
	// Comments complexity weights
	Comment comments.Weights `xml:"comment"`
	// Code structure complexity weights
	CodeStructComp codestruct.Weights `xml:"codestruct"`
	// Inline data complexity weights
	InlineData inline.Weights `xml:"inline"`
	// Arithmetic expression complexity weights
	ArithmeticComp arithmetic.Weights `xml:"arithmetic"`
	// Halstead metric weight
	Halstead float64 `xml:"halstead"`
}

Config with all weights for underlaying metrics

type MeasurerWMFP

type MeasurerWMFP struct {
	// State of comments metrics
	Comments *comments.Metric
	// State of cyclo complexity metrics
	Cyclo *cyclo.Metric
	// State of halstead metrics
	Halst *halstead.Metric
	// State of complexity of code structure
	Codestruct *codestruct.Metric
	// State of complexity of inline data constants
	InlineData *inline.Metric
	// State of complexity of arithmetic expressions
	ArithmeticComp *arithmetic.Metric
	// contains filtered or unexported fields
}

State for WMFP metrics

func NewMeasurerWMFP

func NewMeasurerWMFP(config *Config) MeasurerWMFP

Constructor for WMFP metric

func (*MeasurerWMFP) Finish

func (m *MeasurerWMFP) Finish() (total float64)

Returns final score of metric

func (*MeasurerWMFP) ParseFile

func (m *MeasurerWMFP) ParseFile(file *ast.File)

Parses single file using WMFP metric

type Metric

type Metric interface {
	// Parses ast node and collects all info for metric
	ParseNode(ast.Node)
	// Returns final score for metric
	Finish() float64
}

Interface for underlaying metrics

Jump to

Keyboard shortcuts

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