pkg

package
v0.0.0-...-d0e143f Latest Latest
Warning

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

Go to latest
Published: May 17, 2025 License: MIT Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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