anlzr

package
v0.0.0-...-620ce17 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2015 License: BSD-3-Clause Imports: 4 Imported by: 1

Documentation

Overview

Package anlzr provides the necessary API for making source code analyzis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Analyzer

type Analyzer interface {
	// Analyze performs an source code analysis on a project and adds the
	// resulting metrics into r.
	Analyze(p *src.Project, r *Result) error
}

An Analyzer represents a source code analyzer which extracts one or more metrics from the structure defined by the src package.

type CommentRatios

type CommentRatios struct {
	TypeComRatio   float32 `json:"type_comment_ratio"`
	StructComRatio float32 `json:"structure_comment_ratio"`
	ConstComRatio  float32 `json:"constant_comment_ratio"`
	VarsComRatio   float32 `json:"variable_comment_ratio"`
	FuncComRatio   float32 `json:"function_comment_ratio"`
	InterComRatio  float32 `json:"interface_comment_ratio"`
	ClassComRatio  float32 `json:"class_comment_ratio"`
	MethComRatio   float32 `json:"method_comment"`
	AttrComRatio   float32 `json:"attribute_comment_ratio"`
	EnumComRatio   float32 `json:"enumeration_comment_ratio"`
}

CommentRatios contains various ratios about documentation coverage.

func (CommentRatios) Analyze

func (dc CommentRatios) Analyze(p *src.Project, r *Result) error

type Complexity

type Complexity struct{}

func (Complexity) Analyze

func (c Complexity) Analyze(p *src.Project, r *Result) error

type ComplexityMetrics

type ComplexityMetrics struct {
	AveragePerFunc float32 `json:"average_per_func" xml:"average-per-func"` // Average complexity per function.
	AveragePerFile float32 `json:"average_per_file" xml:"average-per-file"` // Average complexity per file.
}

CyclomaticComplexity metrics, also known as McCabe metric.

type Language

type Language struct {
	src.Language
	Lines int64 `json:"lines" xml:"lines"`
}

A Language represents a programming language used by the project.

type LoC

type LoC struct{}

func (LoC) Analyze

func (lca LoC) Analyze(p *src.Project, r *Result) error

type LocPerLang

type LocPerLang struct{}

func (LocPerLang) Analyze

func (lpl LocPerLang) Analyze(p *src.Project, r *Result) error

type Result

type Result struct {
	ProgLangs      []Language        `json:"programming_languages" xml:"programming-languages"`
	AverageFuncLen float32           `json:"average_function_length" xml:"average-function-length"`
	MaxFuncLen     int64             `json:"max_function_length" xml:"max-function-length"`
	MinFuncLen     int64             `json:"min_function_length" xml:"min-function-length"`
	MedianFuncLen  int64             `json:"median_function_length" xml:"median-function-length"`
	TotalLoC       int64             `json:"total_loc" xml:"total-loc"`
	Complexity     ComplexityMetrics `json:"complexity" xml:"complexity"`
	DocCoverage    CommentRatios     `json:"documentation_coverage" xml:"documentation-coverage"`
}

A Result holds all source code analysis metrics output by srcanlzr.

func RunAnalyzers

func RunAnalyzers(p *src.Project, a ...Analyzer) (*Result, error)

RunAnalyzers runs several analyzers on a project.

Jump to

Keyboard shortcuts

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