linter

package
v1.34.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2020 License: GPL-3.0 Imports: 9 Imported by: 50

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

	LoadMode packages.LoadMode

	InPresets        []string
	AlternativeNames []string

	OriginalURL     string // URL of original (not forked) repo, needed for autogenerated README
	CanAutoFix      bool
	IsSlow          bool
	DoesChangeTypes bool
}

func NewConfig

func NewConfig(linter Linter) *Config

func (*Config) AllNames added in v1.10.2

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

func (*Config) ConsiderSlow added in v1.19.0

func (lc *Config) ConsiderSlow() *Config

func (*Config) IsSlowLinter added in v1.19.0

func (lc *Config) IsSlowLinter() bool

func (*Config) Name added in v1.10.2

func (lc *Config) Name() string

func (*Config) WithAlternativeNames added in v1.10.2

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

func (*Config) WithAutoFix added in v1.15.0

func (lc *Config) WithAutoFix() *Config

func (*Config) WithChangeTypes added in v1.27.0

func (lc *Config) WithChangeTypes() *Config

func (*Config) WithLoadFiles added in v1.19.0

func (lc *Config) WithLoadFiles() *Config

func (*Config) WithLoadForGoAnalysis added in v1.19.0

func (lc *Config) WithLoadForGoAnalysis() *Config

func (*Config) WithPresets

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

func (*Config) WithURL

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

type Context

type Context struct {
	// Packages are deduplicated (test and normal packages) packages
	Packages []*packages.Package

	// OriginalPackages aren't deduplicated: they contain both normal and test
	// version for each of packages
	OriginalPackages []*packages.Package

	Cfg       *config.Config
	FileCache *fsutils.FileCache
	LineCache *fsutils.LineCache
	Log       logutils.Log

	PkgCache  *pkgcache.Cache
	LoadGuard *load.Guard
}

func (*Context) ClearTypesInPackages added in v1.23.2

func (c *Context) ClearTypesInPackages()

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
}

Jump to

Keyboard shortcuts

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