semverlint

package module
v0.0.0-...-15a3fd1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 11 Imported by: 0

README

semverlint

semverlint checks the API changes between the HEAD of a project and its latest release and tells you whether you should be using a new major version and a detailed report of what changes have been made to the public API of your package.

TODO
  • Finish diffing
  • Testing
  • CLI
  • Prettier reports
LICENSE

MIT, see LICENSE

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBreaking

func IsBreaking(change Change) bool

Types

type API

type API []Package

API that is exposed on a project.

func ProjectAPI

func ProjectAPI(path string) (API, error)

ProjectAPI returns the public API of the project at the given path.

func VersionAPI

func VersionAPI(path string, version Version) (API, error)

VersionAPI returns the public API of the project at the given path at the given version.

type APIChanges

type APIChanges []PackageChanges

func Diff

func Diff(current, prev API) APIChanges

Diff computes the difference between two given public APIs.

type Added

type Added struct{}

func (Added) String

func (Added) String() string

type ArgumentChanged

type ArgumentChanged struct {
	Pos     int
	Name    string
	Type    types.Type
	Changes []Change
}

func (ArgumentChanged) String

func (a ArgumentChanged) String() string

type Change

type Change interface {
	String() string
}

type Const

type Const struct {
	Name  string
	Type  types.Type
	Value string
}

Const is an exposed constant.

type DeclChange

type DeclChange struct {
	Name    string
	Type    DeclType
	Changes []Change
}

func NewDeclChange

func NewDeclChange(name string, typ DeclType, changes ...Change) DeclChange

func (DeclChange) String

func (d DeclChange) String() string

type DeclType

type DeclType byte
const (
	VarType DeclType = iota
	ConstType
	FuncType
	InterfaceType
	StructType
	TypeDefType
	PackageType
)

func (DeclType) String

func (d DeclType) String() string

type Field

type Field struct {
	Name string
	Type types.Type
}

Field exposed in a struct.

type FieldChanged

type FieldChanged struct {
	Pos     int
	Name    string
	Changes []Change
}

func (FieldChanged) String

func (f FieldChanged) String() string

type Func

type Func struct {
	Name   string
	Args   []types.Type
	Return []types.Type
}

Func or method exposed.

type Interface

type Interface struct {
	Name    string
	Methods []Func
}

Interface exposed.

type Package

type Package struct {
	Name       string
	Path       string
	Vars       []Var
	Consts     []Const
	Funcs      []Func
	Structs    []Struct
	Interfaces []Interface
	Types      []TypeDef
}

Package with all its exposed members.

type PackageChanges

type PackageChanges struct {
	Name    string
	Path    string
	Changes []Change
}

func NewPackageChanges

func NewPackageChanges(name, path string, changes ...Change) PackageChanges

type PositionChanged

type PositionChanged struct {
	From int
	To   int
}

func (PositionChanged) String

func (p PositionChanged) String() string

type Removed

type Removed struct{}

func (Removed) String

func (Removed) String() string

type ResultChanged

type ResultChanged struct {
	Pos     int
	Type    types.Type
	Changes []Change
}

func (ResultChanged) String

func (r ResultChanged) String() string

type Struct

type Struct struct {
	Name    string
	Fields  []Field
	Methods []Func
}

Struct exposed.

type TypeChanged

type TypeChanged struct {
	From types.Type
	To   types.Type
}

func (TypeChanged) String

func (tc TypeChanged) String() string

type TypeDef

type TypeDef struct {
	Name  string
	Type  types.Type
	Alias bool
}

TypeDef is a type definition of the type `type A B` or `type A = B`.

type ValueChanged

type ValueChanged struct {
	From string
	To   string
}

func (ValueChanged) String

func (v ValueChanged) String() string

type Var

type Var struct {
	Name string
	Type types.Type
}

Var is an exposed variable.

type Version

type Version struct {
	Name   string
	Commit plumbing.Hash
}

Version of a project.

func Versions

func Versions(path string) ([]Version, error)

Versions returns a list of versions for the repository at the given path.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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