implements

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportProblems

func ReportProblems(
	pass *analysis.Pass,
	missingPackages []MissingPackageReport,
	missingInterfaces []MissingInterfaceReport,
	missingMethods []MissingMethodsReport,
	ignoreSet *util.IgnoreSet,
)

ReportProblems reports all implements violations using the new pretty formatter. Supports @ignore directives for suppressing violations when needed.

Types

type InterfaceMethod

type InterfaceMethod struct {
	Name    string
	Inputs  []InterfaceType
	Outputs []InterfaceType
}

InterfaceMethod FIXME store signature @immutable

type InterfaceModel

type InterfaceModel struct {
	Name    string
	Package string
	Methods []InterfaceMethod
}

InterfaceModel @immutable

func LoadInterfaces

func LoadInterfaces(pass *analysis.Pass, queries []annotations.InterfaceQuery) []*InterfaceModel

LoadInterfaces loads specified interfaces from the analysis pass

type InterfaceType

type InterfaceType struct {
	TypeName    string
	TypePackage string
	IsPointer   bool
	IsVariadic  bool
}

InterfaceType @immutable @constructor extractTypesFromTuple, convertTypesToInterfaceType

type MethodType

type MethodType struct {
	TypeName    string
	TypePackage string
	IsPointer   bool
	IsVariadic  bool
}

MethodType represents a type in method signature @immutable @constructor convertTypesToMethodType, extractMethodTypesFromTuple

type MissingInterfaceReport

type MissingInterfaceReport struct {
	InterfaceName string
	PackageName   string
	TypeName      string
	Pos           token.Pos
}

@immutable implements reporting.Violation

func FindMissingInterfaces

func FindMissingInterfaces(
	annotations []annotations.ImplementsAnnotation,
	interfaces []*InterfaceModel,
) []MissingInterfaceReport

FindMissingInterfaces identifies annotations where the interface was not found

func (MissingInterfaceReport) GetCode

func (v MissingInterfaceReport) GetCode() string

GetCode returns the error code for this violation

func (MissingInterfaceReport) GetMessage

func (v MissingInterfaceReport) GetMessage() string

GetMessage returns the main error message without formatting

func (MissingInterfaceReport) GetPos

func (v MissingInterfaceReport) GetPos() token.Pos

GetPos returns the position of the violation

type MissingMethodsReport

type MissingMethodsReport struct {
	InterfaceName string
	PackageName   string
	TypeName      string
	Methods       []InterfaceMethod // Full method signatures
	Pos           token.Pos
}

@immutable implements reporting.Violation

func FindMissingMethods

func FindMissingMethods(
	annotations []annotations.ImplementsAnnotation,
	interfaces []*InterfaceModel,
	types []*TypeModel,
) []MissingMethodsReport

FindMissingMethods identifies types that don't implement required interfaces

func (MissingMethodsReport) GetCode

func (v MissingMethodsReport) GetCode() string

GetCode returns the error code for this violation

func (MissingMethodsReport) GetMessage

func (v MissingMethodsReport) GetMessage() string

GetMessage returns the main error message without formatting

func (MissingMethodsReport) GetPos

func (v MissingMethodsReport) GetPos() token.Pos

GetPos returns the position of the violation

type MissingPackageReport

type MissingPackageReport struct {
	PackageName string
	TypeName    string
	Pos         token.Pos
}

@immutable implements reporting.Violation

func FindMissingPackages

func FindMissingPackages(annotations []annotations.ImplementsAnnotation) []MissingPackageReport

FindMissingPackages identifies annotations with unresolved package references

func (MissingPackageReport) GetCode

func (v MissingPackageReport) GetCode() string

GetCode returns the error code for this violation

func (MissingPackageReport) GetMessage

func (v MissingPackageReport) GetMessage() string

GetMessage returns the main error message without formatting

func (MissingPackageReport) GetPos

func (v MissingPackageReport) GetPos() token.Pos

GetPos returns the position of the violation

type TypeMethod

type TypeMethod struct {
	Name              string
	Inputs            []MethodType
	Outputs           []MethodType
	ReceiverIsPointer bool // true if receiver is *T, false if T
}

TypeMethod represents a method of a type @immutable

type TypeModel

type TypeModel struct {
	Name           string
	Package        string
	UnderlyingType string // "struct", "int", "string", etc. // FIXME Do We need this?
	Methods        []TypeMethod
}

TypeModel represents a parsed named type with its methods @immutable

func LoadTypes

func LoadTypes(pass *analysis.Pass, queries []annotations.TypeQuery) []*TypeModel

LoadTypes loads specified named types from the current package

Jump to

Keyboard shortcuts

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