Documentation
¶
Index ¶
Constants ¶
const ( // SeverityWarning declares failures of type warning SeverityWarning = "warning" // SeverityError declares failures of type error. SeverityError = "error" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AbstractRule ¶
type AbstractRule struct {
Failures []Failure
}
AbstractRule defines an abstract rule.
type Config ¶
type Config struct {
IgnoreGeneratedHeader bool `toml:"ignoreGeneratedHeader"`
Confidence float64
Severity Severity
Rules RulesConfig `toml:"rule"`
ErrorCode int `toml:"errorCode"`
WarningCode int `toml:"warningCode"`
}
Config defines the config of the linter.
type DisabledInterval ¶
DisabledInterval contains a single disabled interval and the associated rule name.
type Failure ¶
type Failure struct {
Failure string
RuleName string
Category string
Position FailurePosition
Node ast.Node `json:"-"`
Confidence float64
URL string
// For future use
ReplacementLine string
}
Failure defines a struct for a linting failure.
func (*Failure) GetFilename ¶
GetFilename returns the filename.
type FailurePosition ¶
FailurePosition returns the failure position
func ToFailurePosition ¶
ToFailurePosition returns the failure position.
type File ¶
type File struct {
Name string
Pkg *Package
AST *ast.File
// contains filtered or unexported fields
}
File abstraction used for representing files.
func (*File) IsUntypedConst ¶
IsUntypedConst reports whether expr is an untyped constant, and indicates what its default type is. scope may be nil.
type Formatter ¶
type Formatter interface {
Format(<-chan Failure, RulesConfig) (string, error)
Name() string
}
Formatter defines an interface for failure formatters
type FormatterMetadata ¶
FormatterMetadata configuration of a formatter
type Linter ¶
type Linter struct {
// contains filtered or unexported fields
}
Linter is used for linting set of files.
type Package ¶
type Package struct {
TypesPkg *types.Package
TypesInfo *types.Info
// sortable is the set of types in the package that implement sort.Interface.
Sortable map[string]bool
// contains filtered or unexported fields
}
Package represents a package in the project.
type RuleConfig ¶
RuleConfig is type used for the rule configuration.
type RulesConfig ¶
type RulesConfig = map[string]RuleConfig
RulesConfig defines the config for all rules.