Documentation ¶
Index ¶
- Constants
- func Name(name string, whitelist, blacklist []string) (should string)
- type AbstractRule
- type Arguments
- type Config
- type DirectiveConfig
- type DirectivesConfig
- type DisabledInterval
- type Failure
- type FailurePosition
- type File
- type Formatter
- type FormatterMetadata
- type Linter
- type Package
- type ReadFile
- type Rule
- type RuleConfig
- type RulesConfig
- type Severity
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 EnableAllRules bool `toml:"enableAllRules"` Rules RulesConfig `toml:"rule"` ErrorCode int `toml:"errorCode"` WarningCode int `toml:"warningCode"` Directives DirectivesConfig `toml:"directive"` Exclude []string `toml:"exclude"` }
Config defines the config of the linter.
type DirectiveConfig ¶
type DirectiveConfig struct {
Severity Severity
}
DirectiveConfig is type used for the linter directive configuration.
type DirectivesConfig ¶
type DirectivesConfig = map[string]DirectiveConfig
DirectivesConfig defines the config for all directives.
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 // 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 ¶
func ToFailurePosition(start, end token.Pos, file *File) FailurePosition
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) CommentMap ¶
func (f *File) CommentMap() ast.CommentMap
CommentMap builds a comment map for the file.
func (*File) IsUntypedConst ¶
IsUntypedConst reports whether expr is an untyped constant, and indicates what its default type is. scope may be nil.
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.