core

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgFunction

type ArgFunction func(lineRange LineRange) []string
var DefaultArgFunction ArgFunction = func(lineRange LineRange) []string {
	return []string{lineRange.File}
}

type Binaries

type Binaries interface {
	Binaries() []*tools.Binary
}

type Checker

type Checker interface {
	Tag() string
	Check(ranges []LineRange) ([]Issue, error)
}

type Config

type Config struct {
	OutputFormat string `yaml:"OutputFormat"`
	OutputFile   string `yaml:"OutputFile"`
	VendorDir    string `yaml:"VendorDir"`
	Color        *bool  `yaml:"Color"`

	InputFile string
}

func NewDefaultConfig

func NewDefaultConfig() Config

func (Config) WithColors added in v0.1.0

func (c Config) WithColors() bool

type ConfigReader

type ConfigReader interface {
	Read() (error, Config)
}

type Converter

type Converter func([]byte) ([]Issue, error)

type DiffParser

type DiffParser interface {
	ParseNextLine(line string)
	Result() []LineRange
}

func NewDiffParser

func NewDiffParser() DiffParser

type Flow

type Flow interface {
	Run(ranges []LineRange) ([]Issue, error)
}

func NewFlow

func NewFlow(tag string, s Settings, opts ...FlowOption) Flow

type FlowOption

type FlowOption func(*flow)

func WithCommand

func WithCommand(command string, args ...string) FlowOption

func WithConverter

func WithConverter(converter Converter) FlowOption

func WithFileExtensions

func WithFileExtensions(exts ...string) FlowOption

func WithShellFactory added in v0.1.0

func WithShellFactory(factory func(...shell.ShellOption) shell.Shell) FlowOption

func WithShellOptions

func WithShellOptions(opts ...shell.ShellOption) FlowOption

type Formatter

type Formatter interface {
	Print(issues []Issue, w io.Writer) error
}

type Issue

type Issue struct {
	Tag      string
	File     string
	Line     int
	Column   int
	Severity string
	Message  string
	Source   string
}

type LineRange

type LineRange struct {
	File  string `json:"file"`
	Start int    `json:"start"`
	End   int    `json:"end"`
}

type Settings

type Settings struct {
	Enabled bool     `yaml:"Enabled"`
	Exclude []string `yaml:"Exclude"`
	Include []string `yaml:"Include"`
	Command string   `yaml:"Command"`
	Config  string   `yaml:"Config"`
}

func (Settings) CommandOrDefault

func (settings Settings) CommandOrDefault(defaultCommand string) string

func (Settings) Filter

func (settings Settings) Filter(ranges []LineRange, supportedExtensions ...string) []LineRange

Jump to

Keyboard shortcuts

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