lint

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 8 Imported by: 52

Documentation

Overview

Package lint provides abstractions on top of go/analysis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExhaustiveTypeSwitch

func ExhaustiveTypeSwitch(v interface{})

ExhaustiveTypeSwitch panics when called. It can be used to ensure that type switches are exhaustive.

func Markdownify added in v0.2.0

func Markdownify(m map[string]*Documentation) map[string]*Documentation

Types

type Analyzer added in v0.2.0

type Analyzer struct {
	// The analyzer's documentation. Unlike go/analysis.Analyzer.Doc,
	// this field is structured, providing access to severity, options
	// etc.
	Doc      *Documentation
	Analyzer *analysis.Analyzer
}

func InitializeAnalyzers

func InitializeAnalyzers(docs map[string]*Documentation, analyzers map[string]*analysis.Analyzer) []*Analyzer

type Directive

type Directive struct {
	Command   string
	Arguments []string
	Directive *ast.Comment
	Node      ast.Node
}

A directive is a comment of the form '//lint:<command> [arguments...]'. It represents instructions to the static analysis tool.

func ParseDirectives

func ParseDirectives(files []*ast.File, fset *token.FileSet) []Directive

type Documentation

type Documentation struct {
	Title      string
	Text       string
	Since      string
	NonDefault bool
	Options    []string
	Severity   Severity
}

func (*Documentation) String

func (doc *Documentation) String() string

type Severity added in v0.2.0

type Severity int
const (
	SeverityNone Severity = iota
	SeverityError
	SeverityDeprecated
	SeverityWarning
	SeverityInfo
	SeverityHint
)

type VersionFlag

type VersionFlag int

func (*VersionFlag) Get

func (v *VersionFlag) Get() interface{}

func (*VersionFlag) Set

func (v *VersionFlag) Set(s string) error

func (*VersionFlag) String

func (v *VersionFlag) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL