printer

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// OutFormatText is a text-based output format, best for CLIs
	OutFormatText = "text"
	// OutFormatSimple is a simplified output format, which can be used with something like https://github.com/reviewdog/reviewdog
	OutFormatSimple = "simple"
	// OutFormatGitHubActions is an output format supported by GitHub Actions annotations
	// https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-a-warning-message
	OutFormatGitHubActions = "github-actions"

	// OutFormatJSON outputs in json
	OutFormatJSON = "json"
)

Variables

OutFormats are all the available output formats. The first one should be the default

View Source
var OutFormatsString = strings.Join(OutFormats, ",")

OutFormatsString is all OutFormats, as a comma-separated string

Functions

This section is empty.

Types

type GitHubActions

type GitHubActions struct{}

GitHubActions is a GitHubActions printer meant for use by a GitHub Action annotation

func NewGitHubActions

func NewGitHubActions() *GitHubActions

NewGitHubActions returns a new GitHubActions printer

type JSON added in v0.2.0

type JSON struct{}

JSON is a JSON printer meant for a machine to read

func NewJSON added in v0.2.0

func NewJSON() *JSON

NewJSON returns a new JSON printer

func (*JSON) Print added in v0.2.0

func (p *JSON) Print(w io.Writer, fs *result.FileResults) error

Print prints in FileResults as json NOTE: The JSON printer will bring each line result as a JSON string. It will not be presented as an array of FileResults. You will neeed to Split by new line to parse the full output

type Printer

type Printer interface {
	Print(io.Writer, *result.FileResults) error
}

Printer is an interface for printing FileResults

func NewPrinter added in v0.1.1

func NewPrinter(f string) (Printer, error)

NewPrinter returns a valid new Printer from a string, or an error if the printer is invalid

type Simple

type Simple struct{}

Simple is a simple printer meant for a machine to read

func NewSimple

func NewSimple() *Simple

NewSimple returns a new simple printer

func (*Simple) Print

func (p *Simple) Print(w io.Writer, fs *result.FileResults) error

Print prints in the format 'filename:line:column: message' based on golint's output: https://github.com/golang/lint/blob/738671d3881b9731cc63024d5d88cf28db875626/golint/golint.go#L121

type Text

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

Text is a text printer meant for humans to read

func NewText

func NewText(disableColor bool) *Text

NewText returns a text Printer with color optionally disabled

func (*Text) Print

func (t *Text) Print(w io.Writer, fs *result.FileResults) error

Print prints the file results

Jump to

Keyboard shortcuts

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