analytics

package
v0.0.0-...-f1dc9d0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DepType

type DepType int
const (
	DepTypeLocal DepType = iota + 1
	DepTypeExternal
)

type File

type File struct {
	Name    string     // file name, not including the path
	Imports []*Package // list of imported packages
	Package *Package   // reference to the package this file belongs to
	Module  *Module    // reference to the module

	Type FileType
	// contains filtered or unexported fields
}

func (*File) AddImport

func (f *File) AddImport(name string)

AddImport adds an import to the file it should find the module we're importing from and the package and add it to the file's imports

func (*File) CalculateComplexity

func (f *File) CalculateComplexity() float32

CalculateComplexity walks the AST of a Go file to calculate its cyclomatic complexity.

func (*File) GetSource

func (f *File) GetSource() []string

func (*File) Lines

func (f *File) Lines() int

type FileType

type FileType int
const (
	Unknown FileType = iota
	HumanGo
	GeneratedGo
	TestGo
)

func NameToFileType

func NameToFileType(name string) FileType

func (FileType) String

func (i FileType) String() string

type Module

type Module struct {
	Path     string // module path ie. github.com/perbu/gogrok
	Location string // file path

	Dependencies              []*Module  // list of dependencies
	Packages                  []*Package // list of packages in the module
	Type                      DepType    // either a local (on-disk) or external (remote) module
	Repo                      *Repo      // reference to the repo
	ReverseModuleDependencies []*Module  // List of modules that depend on this module
	// contains filtered or unexported fields
}

func (*Module) AddPackage

func (m *Module) AddPackage(p *Package)

func (*Module) AddVersion

func (m *Module) AddVersion(version string)

func (*Module) CalculateComplexity

func (m *Module) CalculateComplexity() float32

func (*Module) Files

func (m *Module) Files() int

func (*Module) GetPackage

func (m *Module) GetPackage(name string) (*Package, bool)

func (*Module) GetVersions

func (m *Module) GetVersions() []string

func (*Module) Latest

func (m *Module) Latest() string

func (*Module) Lines

func (m *Module) Lines() int

func (*Module) LoadSource

func (m *Module) LoadSource() error

LoadSource loads the source code for a local module.

type Package

type Package struct {
	Name     string  // package name
	Location string  // file path, relative to the module
	Module   *Module // reference to the module

	ReverseDependencies []*Package // list of packages that depend on this package
	// contains filtered or unexported fields
}

func (*Package) AddFile

func (p *Package) AddFile(name string, file *ast.File) *File

AddFile adds a file to the package

func (*Package) CalculateComplexity

func (p *Package) CalculateComplexity() float32

func (*Package) Files

func (p *Package) Files() int

func (*Package) Generated

func (p *Package) Generated() float32

Generated returns the ratio of generated files in the package, 1.0 means all files are generated, 0.0 means none are generated

func (*Package) GetFile

func (p *Package) GetFile(name string) (*File, bool)

func (*Package) GetFiles

func (p *Package) GetFiles() []*File

func (*Package) Lines

func (p *Package) Lines() int

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func New

func New(path string) (*Repo, error)

func (*Repo) FindModule

func (r *Repo) FindModule(path string) (string, bool)

FindModule finds a module from a full import path. It works by checking the module directory. If the module is not found it will chop off the last part of the path and try again.

func (*Repo) GetModule

func (r *Repo) GetModule(path string) (*Module, bool)

func (*Repo) GetModuleNames

func (r *Repo) GetModuleNames() []string

func (*Repo) ModuleFilter

func (r *Repo) ModuleFilter(t DepType, substring string) []Module

func (*Repo) Parse

func (r *Repo) Parse() error

func (*Repo) ParseMod

func (r *Repo) ParseMod(modulePath string) error

Jump to

Keyboard shortcuts

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