linter

package
v0.19.80 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ShowPass = true

ShowPass is a global that will turn on and off printing files that report success

Functions

func GetName

func GetName(l Linter) string

GetName GetName

func LintFileList

func LintFileList(l Linter, fileList []string) error

LintFileList simply takes a single Linter and runs it for each file

Types

type Language

type Language struct {
	Name  string
	Match *regexp.Regexp // Regex to identify files
	Fmt   Linter         // Formatting tool
	Chk   Linter         // Convention linting tool - Errors on any problem
}

Language is used to associate a file pattern to the relevant tools to check and format

func (Language) GetLinter

func (l Language) GetLinter(which string) Linter

GetLinter allows for string indexing to get fmt or chk... TODO remove requirement for this function

type Linter

type Linter interface {
	Name() string
	WillRun() error
	DidRun()
	MaxConcurrency() int
	Run(filepath string, rep chan Report)
}

Linter is a simple inteface to enable a setup and check using WillRun before executing multiple Run's

type Report

type Report struct {
	File   string
	Err    error
	StdOut io.Reader
	StdErr io.Reader
}

Report is used to state what issues a given file has

func (*Report) Log

func (rep *Report) Log() error

Log simple takes all fields and pushes them to our using the default logger

Jump to

Keyboard shortcuts

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