formatters

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	FormatViolations(header string, violations []domain.Violation) string
	FormatViolationsCount(violationsCount *domain.ViolationsCount) string
	FormatMessage(message string) string
	FormatServerMessage(message string) string
	FormatRule(rule *domain.Rule) string
}

Formatter provides an interface for output formatters

func NewFormatter

func NewFormatter(format string) (Formatter, error)

NewFormatter creates a formatter for a given format

type MarkdownFormatter

type MarkdownFormatter struct {
}

MarkdownFormatter is used to generate output in markdown format

func (*MarkdownFormatter) FormatMessage

func (f *MarkdownFormatter) FormatMessage(message string) string

FormatMessage formats message

func (*MarkdownFormatter) FormatRule

func (f *MarkdownFormatter) FormatRule(rule *domain.Rule) string

FormatRule formats rule description

func (*MarkdownFormatter) FormatServerMessage

func (f *MarkdownFormatter) FormatServerMessage(message string) string

FormatServerMessage formats server message

func (*MarkdownFormatter) FormatViolations

func (f *MarkdownFormatter) FormatViolations(header string, violations []domain.Violation) string

FormatViolations formats the list of the violations

func (*MarkdownFormatter) FormatViolationsCount

func (f *MarkdownFormatter) FormatViolationsCount(violationsCount *domain.ViolationsCount) string

FormatViolationsCount generates violation counters in in markdown format

type PrettyColorizer

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

PrettyColorizer is used to generate ANSII colors for output

func NewPrettyColorizer

func NewPrettyColorizer(useColors bool) *PrettyColorizer

NewPrettyColorizer creates an instance of PrettyColorizer

func (*PrettyColorizer) ColorizeByTypeFunc

func (c *PrettyColorizer) ColorizeByTypeFunc(ruleType string) func(interface{}) aurora.Value

ColorizeByTypeFunc returns color function by a given type

type PrettyFormatter

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

PrettyFormatter is used to generate violations in pretty format

func NewPrettyFormatter

func NewPrettyFormatter(colorizer *PrettyColorizer) PrettyFormatter

NewPrettyFormatter creates a formatter for text output

func (*PrettyFormatter) FormatMessage

func (f *PrettyFormatter) FormatMessage(message string) string

FormatMessage formats message

func (*PrettyFormatter) FormatRule

func (f *PrettyFormatter) FormatRule(rule *domain.Rule) string

FormatRule formats rule description

func (*PrettyFormatter) FormatServerMessage

func (f *PrettyFormatter) FormatServerMessage(message string) string

FormatServerMessage formats server message

func (*PrettyFormatter) FormatViolations

func (f *PrettyFormatter) FormatViolations(header string, violations []domain.Violation) string

FormatViolations formats the list of the violations

func (*PrettyFormatter) FormatViolationsCount

func (f *PrettyFormatter) FormatViolationsCount(violationsCount *domain.ViolationsCount) string

FormatViolationsCount generates violation counters in in pretty format

Jump to

Keyboard shortcuts

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