api

package
v0.0.0-...-27f9dfe Latest Latest
Warning

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

Go to latest
Published: May 29, 2018 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

Package api provides the plugin api to be implemented by linters and consumed by gomultilinter

Index

Constants

View Source
const (
	// LinterFactorySymbolName is the name of the exported Symbol which provides
	// the entry point of a linter plugin
	LinterFactorySymbolName = "LinterFactory"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File struct {
	*Package
	ASTFile    *ast.File
	CommentMap ast.CommentMap
	Position   *token.Position
}

File represents a parsed go file

type FileLinter

type FileLinter interface {
	Linter
	LintFile(ctx context.Context, file *File, reporter IssueReporter) error
}

FileLinter lints files

type Issue

type Issue struct {
	Position token.Position
	Severity Severity
	Category string
	Message  string
}

Issue represents a linter-issue

type IssueReporter

type IssueReporter interface {
	Debug(msg string, fields ...interface{})
	Report(issue *Issue)
}

IssueReporter collects resultig issues from the linters fields is a list of key-value-pairs to include in the log msg

type Linter

type Linter interface {
	Name() string
}

Linter base interface. concrete impls should implement Linter and one of the ...Linter interfaces below

type LinterConfig

type LinterConfig interface {
	NewLinter() (Linter, error)
}

LinterConfig is the struct to which the config gets deserialized and which is used to construct new Linter instances

type LinterFactory

type LinterFactory interface {
	NewLinterConfig() LinterConfig
}

LinterFactory returns a pointer to a new LinterConfig

type Package

type Package struct {
	PkgInfo *loader.PackageInfo
	FSet    *token.FileSet
}

Package represents a parsed go package

type PackageLinter

type PackageLinter interface {
	Linter
	LintPackage(ctx context.Context, pkg *Package, reporter IssueReporter) error
}

PackageLinter lints packages

type Severity

type Severity int8

Severity of linter issue ENUM( Info, Warning, Error )

const (
	// SeverityInfo is a Severity of type Info
	SeverityInfo Severity = iota
	// SeverityWarning is a Severity of type Warning
	SeverityWarning
	// SeverityError is a Severity of type Error
	SeverityError
)

func ParseSeverity

func ParseSeverity(name string) (Severity, error)

ParseSeverity attempts to convert a string to a Severity

func (Severity) String

func (i Severity) String() string

Jump to

Keyboard shortcuts

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