splitfile

package module
v0.0.0-...-e510e09 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2019 License: GPL-3.0 Imports: 8 Imported by: 0

README

splitfile

CircleCI codecov Maintainability Test Coverage Go Report Card

splitfile aims to improve Go code readability by reducing the lines of code per file and ultimately improving the focus of files in a package.

How it Works

splitfile identifies partitions of packages via the following method. First, a weighted directed graph is constructed, where nodes are type, var, const, or func declarations and weighted directed edges define the relationships between declarations and their uses. splitfile identifies partitions by assigning configurable weights to edges (i.e., type -> method edges should probably be of a higher weight than type -> usage edges, but this is ultimately up to the user). Next, these weights are used by the distance function. After calculating the distance of all paths, partitions are identified by comparing the distance to a configurable epsilon value. Paths with a distance greater than epsilon will be partitioned, leaving path with a distance less than epsilon "clustered".

configurable: edge weights and epsilon can be configured via cli flags or a .splitfile.yml file.

License

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Analyzer = &analysis.Analyzer{
	Name:     "splitfile",
	Doc:      "checks for clean splits of files in packages based on objects and their relationships with other objects.",
	Requires: []*analysis.Analyzer{inspect.Analyzer},
	Run:      run,
}

Functions

func Id

func Id(ider Ider) string

Types

type Ider

type Ider interface {
	Pkg() *types.Package
	Name() string
	Pos() token.Pos
}

type Poser

type Poser interface {
	Pos() token.Pos
}

type Typer

type Typer interface {
	Type() types.Type
}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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