linter

package
v1.17.2 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PresetFormatting  = "format"
	PresetComplexity  = "complexity"
	PresetStyle       = "style"
	PresetBugs        = "bugs"
	PresetUnused      = "unused"
	PresetPerformance = "performance"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Linter           Linter
	EnabledByDefault bool

	NeedsTypeInfo bool
	NeedsSSARepr  bool

	InPresets        []string
	Speed            int // more value means faster execution of linter
	AlternativeNames []string

	OriginalURL      string // URL of original (not forked) repo, needed for autogenerated README
	ParentLinterName string // used only for megacheck's children now
	CanAutoFix       bool
}

func NewConfig

func NewConfig(linter Linter) *Config

func (*Config) AllNames added in v1.17.2

func (lc *Config) AllNames() []string

func (*Config) GetSpeed

func (lc *Config) GetSpeed() int

func (*Config) Name added in v1.17.2

func (lc *Config) Name() string

func (*Config) WithAlternativeNames added in v1.17.2

func (lc *Config) WithAlternativeNames(names ...string) *Config

func (*Config) WithAutoFix added in v1.17.2

func (lc *Config) WithAutoFix() *Config

func (*Config) WithParent added in v1.17.2

func (lc *Config) WithParent(parentLinterName string) *Config

func (*Config) WithPresets

func (lc *Config) WithPresets(presets ...string) *Config

func (*Config) WithSSA

func (lc *Config) WithSSA() *Config

func (*Config) WithSpeed

func (lc *Config) WithSpeed(speed int) *Config

func (*Config) WithTypeInfo added in v1.17.2

func (lc *Config) WithTypeInfo() *Config

func (*Config) WithURL

func (lc *Config) WithURL(url string) *Config

type Context

type Context struct {
	Packages             []*packages.Package
	NotCompilingPackages []*packages.Package

	LoaderConfig *loader.Config  // deprecated, don't use for new linters
	Program      *loader.Program // deprecated, use Packages for new linters

	SSAProgram *ssa.Program // for unparam and interfacer but not for megacheck (it change it)

	Cfg       *config.Config
	ASTCache  *astcache.Cache
	FileCache *fsutils.FileCache
	LineCache *fsutils.LineCache
	Log       logutils.Log
}

func (*Context) Settings

func (c *Context) Settings() *config.LintersSettings

type Linter

type Linter interface {
	Run(ctx context.Context, lintCtx *Context) ([]result.Issue, error)
	Name() string
	Desc() string
}

type MetaLinter added in v1.17.2

type MetaLinter interface {
	Name() string
	BuildLinterConfig(enabledChildren []string) (*Config, error)
	AllChildLinterNames() []string
	DefaultChildLinterNames() []string
}

Jump to

Keyboard shortcuts

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