core

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SumStatMerger

func SumStatMerger(numbersToMerge []interface{}) interface{}

Types

type Analyzer

type Analyzer interface {
	Analyze() (*Results, error)
	RootPath() string

	AddDefinition(definition *definitions.Definition)
	RegisterStatAccumulator(statType string, merger StatAccumulatorFunction)
	RegisterView(viewFactory *ViewFactory)
	RegisterFileAnalyzer(analyzer FileAnalyzer)
	RegisterFileResultsEditor(editor FileResultsEditor)
	RegisterResultsEditor(editor ResultsEditor)
}

func New

func New(config *Config) Analyzer

type Column

type Column struct {
	Name string
	Type ColumnType
}

func DateColumn

func DateColumn(name string) *Column

func FloatColumn

func FloatColumn(name string) *Column

func IntColumn

func IntColumn(name string) *Column

func PositionInFileColumn

func PositionInFileColumn(name string) *Column

func StringColumn

func StringColumn(name string) *Column

type ColumnType

type ColumnType int
const (
	Integer ColumnType = iota
	Float
	String
	Date
	PositionInFile
)

type Config

type Config struct {
	// RootPath is the path to the root directory of the codebase to analyze. If not specified, the current working directory is used.
	RootPath string
	// Extensions are the extensions to use for the analysis.
	Extensions []Extension
}

Config represents the settings for an analysis.

type Extension

type Extension interface {
	Init(settings Analyzer) error
}

Extension represents an extension to the analysis. All Archstats extensions must implement this interface and live outside the core package

type FileAnalyzer

type FileAnalyzer interface {
	AnalyzeFile(file.File) *file.Results
}

type FileResultsEditor

type FileResultsEditor interface {
	EditFileResults(all []*file.Results)
}

type Results

type Results struct {
	RootDirectory string

	Snippets            []*file.Snippet
	SnippetsByFile      file.SnippetGroup
	SnippetsByDirectory file.SnippetGroup
	SnippetsByComponent file.SnippetGroup
	SnippetsByType      file.SnippetGroup

	Stats            *file.Stats
	StatsByFile      file.StatsGroup
	StatsByDirectory file.StatsGroup
	StatsByComponent file.StatsGroup

	Connections     []*component.Connection
	ConnectionsFrom map[string][]*component.Connection
	ConnectionsTo   map[string][]*component.Connection

	FileToComponent map[string]string
	FileToDirectory map[string]string

	ComponentToFiles map[string][]string
	DirectoryToFiles map[string][]string

	ComponentGraph *component.Graph

	Views []*View
	// contains filtered or unexported fields
}

Results represents the results of an analysis in pre-aggregated form.

func (*Results) GetDefinition

func (r *Results) GetDefinition(str string) *definitions2.Definition

func (*Results) GetDefinitions

func (r *Results) GetDefinitions() map[string]*definitions2.Definition

func (*Results) GetViewFactories

func (r *Results) GetViewFactories() []*ViewFactory

func (*Results) RenderView

func (r *Results) RenderView(viewName string) (*View, error)

type ResultsEditor

type ResultsEditor interface {
	EditResults(results *Results)
}

type Row

type Row struct {
	Data RowData
}

type RowData

type RowData map[string]interface{}

type StatAccumulatorFunction

type StatAccumulatorFunction func(statsToMerge []interface{}) interface{}

type View

type View struct {
	Name    string
	Columns []*Column
	Rows    []*Row
}

type ViewFactory

type ViewFactory struct {
	Name           string
	CreateViewFunc ViewFactoryFunction
}

type ViewFactoryFunction

type ViewFactoryFunction func(results *Results) *View

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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