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 ¶
NewAnalyzer returns a new Analyzer configured with options that checks for missing calls.
Types ¶
type Config ¶
type Config struct { // DisableAll disables all rules. DisableAll bool `yaml:"disable-all" mapstructure:"disable-all"` // Disabled disables the given rules. Disabled []string // Enabled enables specific rules, in combination with disable all. Enabled []string // Rules are the rules to process, disabled rules will be skipped. Rules []Rule // contains filtered or unexported fields }
Config represents the configuration for uncalled Analyzer.
type Expect ¶
type Expect struct { // Call is the call to expect on this result. // Methods called on the result should start with a "." // for example .Err Call string // Args are the arguments passed to the method. // Currently on the count matters. Args []string }
Expect represents a result call expectation.
type Option ¶
type Option func(*analyzer) error
Option represents an Analyzer option.
func ConfigFile ¶
ConfigFile is an Analyzer option which loads and merges a config from file to our default config. Default: embedded config.
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 // Expect sets the expectation for the result. // At least one Result in a rule must have a method specified. // If not specified no check it performed. Expect *Expect // contains filtered or unexported fields }
Result is a result expected from a rule call.
type Rule ¶
type Rule struct { // Name is the name of the rule. Name string // Category is the category used to report failures for this rule. Category string // Packages is the list of package imports which to be considered // When processing this rule. If one of the listed packages isn't // imported by the code being checked the rule is automatically // skipped. At least one package must be specified. Packages []string // Call represents the call to match to trigger rule processing. // Methods is a list of method calls on the package which trigger // the rule to be checked. // TODO: Implemented. Methods []string // Results represents the results the matched methods return. Results []*Result // contains filtered or unexported fields }
Rule represents an individual rule for uncalled Analyzer.
Click to show internal directories.
Click to hide internal directories.