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 AnalysisMeasurementKey
- type CumulativeChecker
- type Documentation
- type Fact
- type FileIgnore
- type Ignore
- type LineIgnore
- type Linter
- type Package
- type Problem
- type Related
- 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 AnalysisMeasurementKey ¶
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
RepeatAnalyzers uint
}
A Linter lints Go source code.
type Problem ¶
type Problem struct {
Pos token.Position
End token.Position
Message string
Check string
Severity Severity
Related []Related
}
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 accommodate 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.