Documentation ¶
Overview ¶
Package lint provides the foundation for tools like staticcheck
Index ¶
- Constants
- func DisplayPosition(fset *token.FileSet, p token.Pos) token.Position
- func FilterChecks(allChecks []*analysis.Analyzer, checks []string) map[string]bool
- func FuncName(f *types.Func) string
- type CumulativeChecker
- type Documentation
- type Fact
- type FileIgnore
- type Ignore
- type LineIgnore
- type Linter
- type Package
- type Positioner
- type Problem
- type Runner
- type Severity
- type Stats
Constants ¶
View Source
const ( StateInitializing = 0 StateGraph = 1 StateProcessing = 2 StateCumulative = 3 )
Variables ¶
This section is empty.
Functions ¶
func FilterChecks ¶
Types ¶
type CumulativeChecker ¶
type Documentation ¶
type Documentation struct { Title string Text string Since string NonDefault bool Options []string }
func (*Documentation) String ¶
func (doc *Documentation) String() string
type FileIgnore ¶
func (*FileIgnore) Match ¶
func (fi *FileIgnore) Match(p Problem) bool
type LineIgnore ¶
func (*LineIgnore) Match ¶
func (li *LineIgnore) Match(p Problem) bool
func (*LineIgnore) String ¶
func (li *LineIgnore) String() string
type Linter ¶
type Linter struct { Checkers []*analysis.Analyzer CumulativeCheckers []CumulativeChecker GoVersion int Config config.Config Stats Stats }
A Linter lints Go source code.
type Positioner ¶
type Problem ¶
type Problem struct { Pos token.Position End token.Position Message string Check string Severity Severity }
Problem represents a problem in some source code.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) Run ¶
func (r *Runner) Run(cfg *packages.Config, patterns []string, analyzers []*analysis.Analyzer, hasCumulative bool) ([]*Package, error)
Run loads packages corresponding to patterns and analyses them with analyzers. It returns the loaded packages, which contain reported diagnostics as well as extracted ignore directives.
Note that diagnostics have not been filtered at this point yet, to accomodate cumulative analyzes that require additional steps to produce diagnostics.
Directories ¶
Path | Synopsis |
---|---|
Package lintdsl provides helpers for implementing static analysis checks.
|
Package lintdsl provides helpers for implementing static analysis checks. |
Package lintutil provides helpers for writing linter command lines.
|
Package lintutil provides helpers for writing linter command lines. |
format
Package format provides formatters for linter problems.
|
Package format provides formatters for linter problems. |
Click to show internal directories.
Click to hide internal directories.