pkg

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package pkg has the main brains of Effrit. @package_owner = @skarlso

Index

Constants

View Source
const (
	// EffritFileName sets the name of the file Effrit is using to save package data.
	EffritFileName = ".effrit_package_data.json"
	// CommentTag is the name of the tag.
	CommentTag = "@package_owner"
	// CommentFormat is the format used to parse a line for owner name.
	CommentFormat = "// " + CommentTag + " = %s"
)

Variables

This section is empty.

Functions

func Check

func Check(projectName string, parallel int, owner, repo string, prNumber int) error

Check will run an analysis of packages and detect if a new dependency has been added to package.

Types

type Package

type Package struct {
	Name               string
	FullName           string
	Imports            []string
	ImportCount        float64
	DependedOnByCount  float64
	DependedOnByNames  []string
	Stability          float64
	Abstractness       float64
	DistanceFromMedian float64
	Dir                string
	GoFiles            []string
}

Package is a single package as determined by go list.

func (Package) MarshalJSON added in v0.1.3

func (p Package) MarshalJSON() ([]byte, error)

MarshalJSON returns a JSON encoding of Package

type Packages

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

Packages represents a collection of packages.

func NewPackages

func NewPackages(parallel int) *Packages

NewPackages returns a new initialized package collection.

func Scan

func Scan(projectName string, parallel int) (*Packages, error)

Scan will scan a project using go list. As go list is running in the background, scan will display a waiting indicator.

func (*Packages) CalculateAbstractnessOfPackages

func (pkg *Packages) CalculateAbstractnessOfPackages() error

CalculateAbstractnessOfPackages will walk all the files in the package and analyses abstractness.

func (*Packages) CalculateDistance

func (pkg *Packages) CalculateDistance()

CalculateDistance will calculate the distance from the main sequence for all packages. 0: As far away from the main sequence as possible 1: Close as possible 0,0: Zone of Pain 1,1: Zone of Uselessness

func (*Packages) CalculateInstability

func (pkg *Packages) CalculateInstability()

CalculateInstability will calculate the instability metric for all packages.

func (*Packages) Display

func (pkg *Packages) Display(colorMode bool)

Display displays the analysed information in a pretty way... TODO: Add multiple display options and Graph generation.

func (*Packages) Dump

func (pkg *Packages) Dump()

Dump dumps the connections between packages in a JSON format for other tools to process.

func (*Packages) GatherDependedOnByCount

func (pkg *Packages) GatherDependedOnByCount()

GatherDependedOnByCount looks for packages which import other packages in the project.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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