uncalled

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package uncalled defines an Analyzer that checks for missing calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAnalyzer

func NewAnalyzer(options ...Option) *analysis.Analyzer

NewAnalyzer returns a new Analyzer which checks the passed packages in addition to calls.

Types

type Call

type Call struct {
	Methods []string
	Results []*Result
}

Call represents the call that results in the return a rule checks for calls on.

type Config

type Config struct {
	Rules []Rule
}

Config represents the configuration for uncalled Analyzer.

type Expect

type Expect struct {
	Method      string
	ResultIndex int `yaml:"resultIndex" mapstructure:"resultIndex"`
	Args        []string
}

Expect is the expected call for a Rule.

type Option

type Option func(*analyzer) error

Option represents an Analyzer option.

func ConfigFile

func ConfigFile(file string) Option

ConfigFile is Analyzer option which configures the config by loading it from file.

func ConfigOpt

func ConfigOpt(cfg *Config) Option

ConfigOpt is Analyzer option which configures the config by specifying it directly.

type Result

type Result struct {
	// Type is name of the type.
	// If "_" then matches any type.
	// If prefixed by "." then matches any type of specified
	// in its Rule.Packages.
	Type string

	// Pointer specifies if this type should be a pointer to
	// the named TypeName.
	Pointer bool
	// contains filtered or unexported fields
}

Result is a result expected from a rule call.

type Rule

type Rule struct {
	Name     string
	Disabled bool
	Severity string
	Packages []string
	Call     Call
	Expect   Expect
	// contains filtered or unexported fields
}

Rule represents an individual rule for uncalled Analyzer.

Jump to

Keyboard shortcuts

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