coupling

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Overview

Package coupling provides functions to evaluate the coupling level respect to a dependency in a Golang project

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyCoupling

type DependencyCoupling struct {
	Dependency     string             `json:"dependency"`     // the dependency evaluated for coupling level
	CouplingLevel  int                `json:"coupling_level"` // calculated coupling level for this dependency
	PackageDetails []*PackageCoupling `json:"details"`        // coupling level detailed by package
}

func CalculateCoupling

func CalculateCoupling(prj *project.ProjectInfo, dep string) (*DependencyCoupling, error)

CalculateCoupling retrieves information about the coupling level of a provided Golang project respect to a specific dependency

An error is returned when it's not possible to get the packages information

type Detail

type Detail struct {
	Line     int    `json:"line"`    // the line where the dependency is used
	Comments string `json:"details"` // details about the use of the dependency in this line
}

type FileCoupling

type FileCoupling struct {
	Package       string   `json:"package"`        // the package
	File          string   `json:"file"`           // the file
	FileContent   string   `json:"file_content"`   // the file content
	Lines         []int    `json:"coupling_lines"` // the line where the dependency is used
	CouplingLevel int      `json:"coupling_level"` // calculated coupling level for this file
	Details       []Detail `json:"details"`        // details about the dependency
}

type PackageCoupling

type PackageCoupling struct {
	Package       string          `json:"package"`        // the package evaluated
	CouplingLevel int             `json:"coupling_level"` // calculated coupling level for this package
	FileDetails   []*FileCoupling `json:"details"`        // coupling level detailed by package
}

type SortFilesByDependencyLevel

type SortFilesByDependencyLevel []*FileCoupling

func (SortFilesByDependencyLevel) Len

func (SortFilesByDependencyLevel) Less

func (a SortFilesByDependencyLevel) Less(i, j int) bool

func (SortFilesByDependencyLevel) Swap

func (a SortFilesByDependencyLevel) Swap(i, j int)

type SortPackagesByDependencyLevel

type SortPackagesByDependencyLevel []*PackageCoupling

func (SortPackagesByDependencyLevel) Len

func (SortPackagesByDependencyLevel) Less

func (a SortPackagesByDependencyLevel) Less(i, j int) bool

func (SortPackagesByDependencyLevel) Swap

func (a SortPackagesByDependencyLevel) Swap(i, j int)

Jump to

Keyboard shortcuts

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