facts

package
v0.4.0-0.dev Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Deprecated = &analysis.Analyzer{
	Name:       "fact_deprecated",
	Doc:        "Mark deprecated objects",
	Run:        deprecated,
	FactTypes:  []analysis.Fact{(*IsDeprecated)(nil)},
	ResultType: reflect.TypeOf(DeprecatedResult{}),
}
View Source
var Directives = &analysis.Analyzer{
	Name:             "directives",
	Doc:              "extracts linter directives",
	Run:              directives,
	RunDespiteErrors: true,
	ResultType:       reflect.TypeOf([]lint.Directive{}),
}
View Source
var Generated = &analysis.Analyzer{
	Name: "isgenerated",
	Doc:  "annotate file names that have been code generated",
	Run: func(pass *analysis.Pass) (interface{}, error) {
		m := map[string]Generator{}
		for _, f := range pass.Files {
			path := pass.Fset.PositionFor(f.Pos(), false).Filename
			g, ok := isGenerated(path)
			if ok {
				m[path] = g
			}
		}
		return m, nil
	},
	RunDespiteErrors: true,
	ResultType:       reflect.TypeOf(map[string]Generator{}),
}
View Source
var Purity = &analysis.Analyzer{
	Name:       "fact_purity",
	Doc:        "Mark pure functions",
	Run:        purity,
	Requires:   []*analysis.Analyzer{buildir.Analyzer},
	FactTypes:  []analysis.Fact{(*IsPure)(nil)},
	ResultType: reflect.TypeOf(PurityResult{}),
}
View Source
var TokenFile = &analysis.Analyzer{
	Name: "tokenfileanalyzer",
	Doc:  "creates a mapping of *token.File to *ast.File",
	Run: func(pass *analysis.Pass) (interface{}, error) {
		m := map[*token.File]*ast.File{}
		for _, af := range pass.Files {
			tf := pass.Fset.File(af.Pos())
			m[tf] = af
		}
		return m, nil
	},
	RunDespiteErrors: true,
	ResultType:       reflect.TypeOf(map[*token.File]*ast.File{}),
}

Functions

This section is empty.

Types

type DeprecatedResult

type DeprecatedResult struct {
	Objects  map[types.Object]*IsDeprecated
	Packages map[*types.Package]*IsDeprecated
}

type Generator

type Generator int
const (
	Unknown Generator = iota
	Goyacc
	Cgo
	Stringer
	ProtocGenGo
)

A list of known generators we can detect

type IsDeprecated

type IsDeprecated struct{ Msg string }

func (*IsDeprecated) AFact

func (*IsDeprecated) AFact()

func (*IsDeprecated) String

func (d *IsDeprecated) String() string

type IsPure

type IsPure struct{}

func (*IsPure) AFact

func (*IsPure) AFact()

func (*IsPure) String

func (d *IsPure) String() string

type PurityResult

type PurityResult map[*types.Func]*IsPure

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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