linter

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2025 License: MIT Imports: 6 Imported by: 0

README

Linter

This package is for implementations of the Linter type in Crie, though the cli package is probably all that is needed there's no reason you can't directly call a library or service that isn't run as a command

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Result added in v1.0.0

func Result(err error) error

Result conditionally wraps an error with a FailedResultError or otherwise passes through nil, it should be used when a linter didn't error but returned a failed result

Types

type FailedResultError added in v1.0.0

type FailedResultError struct {
	// contains filtered or unexported fields
}

FailedResultError means a linter didn't error but returned a failed result

func (*FailedResultError) Error added in v1.0.0

func (e *FailedResultError) Error() string

Error implements the error interface

type Linter

type Linter interface {
	Name() string
	WillRun() error
	Cleanup(wg *sync.WaitGroup)
	MaxConcurrency() int
	Run(filePath string, rep chan Report)
}

Linter is a simple interface 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

type Runner

type Runner struct {
	ShowPass      bool
	StrictLogging bool
}

Runner will handle parallel runs of linters

func (*Runner) LintFileList

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

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

func (*Runner) Log

func (r *Runner) Log(rep *Report) error

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

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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