package lint
import "honnef.co/go/tools/lint"
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
- func NewRunner(stats *Stats) (*Runner, error)
- func (r *Runner) Run(cfg *packages.Config, patterns []string, analyzers []*analysis.Analyzer, hasCumulative bool) ([]*Package, error)
- type Severity
- type Stats
Constants ¶
const ( StateInitializing = 0 StateGraph = 1 StateProcessing = 2 StateCumulative = 3 )
Functions ¶
func DisplayPosition ¶
func FilterChecks ¶
func FuncName ¶
Types ¶
type AnalysisMeasurementKey ¶
type CumulativeChecker ¶
type CumulativeChecker interface { Analyzer() *analysis.Analyzer Result() []types.Object ProblemObject(*token.FileSet, types.Object) Problem }
type Documentation ¶
type Documentation struct { Title string Text string Since string NonDefault bool Options []string }
func (*Documentation) String ¶
func (doc *Documentation) String() string
type Fact ¶
type FileIgnore ¶
func (*FileIgnore) Match ¶
func (fi *FileIgnore) Match(p Problem) bool
type Ignore ¶
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.
func (*Linter) Lint ¶
type Package ¶
type Package struct { *packages.Package Imports []*Package // contains filtered or unexported fields }
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.
func (Problem) Equal ¶
func (*Problem) String ¶
type Related ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func NewRunner ¶
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.
type Severity ¶
type Severity uint8
type Stats ¶
type Stats struct { State uint32 InitialPackages uint32 TotalPackages uint32 ProcessedPackages uint32 ProcessedInitialPackages uint32 Problems uint32 ActiveWorkers uint32 TotalWorkers uint32 PrintAnalyzerMeasurement func(*analysis.Analyzer, *Package, time.Duration) }
func (*Stats) MeasureAnalyzer ¶
Source Files ¶
lint.go runner.go stats.go
Directories ¶
Path | Synopsis |
---|---|
lint/lintdsl | Package lintdsl provides helpers for implementing static analysis checks. |
lint/lintutil | Package lintutil provides helpers for writing linter command lines. |
lint/lintutil/format | Package format provides formatters for linter problems. |
lint/testutil |
- Version
- v0.0.1-2020.1.5
- Published
- Jul 30, 2020
- Platform
- js/wasm
- Imports
- 26 packages
- Last checked
- 1 minute ago –
Tools for package owners.