diagnostics

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type ConvertToMessage

type ConvertToMessage struct {
	IntConverter
	SeverityConvert
}

func (ConvertToMessage) ConvertElements

func (c ConvertToMessage) ConvertElements(elems []Elements, errs *errors.Errors) []Message

type Diagnostics

type Diagnostics map[string]Provider

type Element

type Element int

ENUM(

File
Message
Column
Line
Severity
Total

)

const (
	// ElementFile is a Element of type File.
	ElementFile Element = iota
	// ElementMessage is a Element of type Message.
	ElementMessage
	// ElementColumn is a Element of type Column.
	ElementColumn
	// ElementLine is a Element of type Line.
	ElementLine
	// ElementSeverity is a Element of type Severity.
	ElementSeverity
	// ElementTotal is a Element of type Total.
	ElementTotal
)

func ParseElement

func ParseElement(name string) (Element, error)

ParseElement attempts to convert a string to a Element.

func (Element) MarshalText

func (x Element) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Element) String

func (x Element) String() string

String implements the Stringer interface.

func (*Element) UnmarshalText

func (x *Element) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type ElementParser

type ElementParser interface {
	ParseElements(r io.Reader) ([]Elements, []error)
}

type Elements

type Elements [ElementTotal]string

type ElementsConverter

type ElementsConverter interface {
	ConvertElements([]Elements) ([]Message, []error)
}

type ElementsProcessor

type ElementsProcessor interface {
	ProcessElements([]Elements) []error
}

type IntConverter

type IntConverter interface {
	ConvertInt(string) (int, error)
}

type LineParser

type LineParser interface {
	ParseLine(line string) (Elements, []error)
}

type LogMessageParser

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

func (LogMessageParser) ParseLines

func (lm LogMessageParser) ParseLines(lines []string) ([]Message, []error)

type LogTemplate

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

func NewLogTemplate

func NewLogTemplate(tpl string, log zerolog.Logger) LogTemplate

func (LogTemplate) ParseElements

func (lt LogTemplate) ParseElements(r io.Reader) ([]Elements, []error)

func (*LogTemplate) WithOrder

func (lt *LogTemplate) WithOrder(ord Order)

type Manager

type Manager struct {
	Out         io.Writer
	Diagnostics Diagnostics
	Printer     Printer
	Log         zerolog.Logger
	// contains filtered or unexported fields
}

func (Manager) HandleDignosticsRequest

func (m Manager) HandleDignosticsRequest(file, kind string) (err error)

type Message

type Message struct {
	File     string   `json:"string"`
	Message  string   `json:"message"`
	Column   int      `json:"column"`
	Line     int      `json:"line"`
	Severity Severity `json:"severity"`
}

type MessageTemplate

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

type NoProcess

type NoProcess struct{}

func NoProc

func NoProc() NoProcess

func (NoProcess) ProcessElements

func (NoProcess) ProcessElements([]Elements) []error

type Order

type Order [ElementTotal]Element

type ParsingMethods

type ParsingMethods struct {
	LinesToElements ElementParser
	Processor       ElementsProcessor
	Converter       ElementsConverter
}

func (ParsingMethods) Parse

func (pm ParsingMethods) Parse(r io.Reader) ([]Message, []error)

type Printer

type Printer func(w io.Writer, msgs []Message) error

type Provider

type Provider interface {
	ProvideDiagnostics(file string) ([]Message, error)
}

type RegexParser

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

type Severity

type Severity int

ENUM(

Error
Warning

)

const (
	// SeverityError is a Severity of type Error.
	SeverityError Severity = iota
	// SeverityWarning is a Severity of type Warning.
	SeverityWarning
)

func ParseSeverity

func ParseSeverity(name string) (Severity, error)

ParseSeverity attempts to convert a string to a Severity.

func (Severity) MarshalText

func (x Severity) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Severity) String

func (x Severity) String() string

String implements the Stringer interface.

func (*Severity) UnmarshalText

func (x *Severity) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type SeverityConvert

type SeverityConvert struct {
	SeverityMap
	Choices []string
}

func NewSeverityConverter

func NewSeverityConverter(sm SeverityMap) SeverityConvert

func (SeverityConvert) Convert

func (sc SeverityConvert) Convert(sev string) (Severity, error)

type SeverityMap

type SeverityMap map[string]Severity

type SeverityNotFoundError

type SeverityNotFoundError struct {
	SeverityString string
	Choices        []string
}

func (SeverityNotFoundError) Error

func (err SeverityNotFoundError) Error() string

type SplitParse

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

func NewSplitParse

func NewSplitParse(sep string, order Order) SplitParse

func (SplitParse) ParseLine

func (s SplitParse) ParseLine(line string) (Elements, error)

type Trim

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

func (Trim) Trim

func (tr Trim) Trim(in string) string

type TrimFields

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

func NewTrimFields

func NewTrimFields(trim Trimmer, fields []Element) TrimFields

func (TrimFields) ProcessElements

func (tf TrimFields) ProcessElements(elems []Elements) []error

type TrimMode

type TrimMode int

ENUM(

Left
Right
All

)

const (
	// TrimModeLeft is a TrimMode of type Left.
	TrimModeLeft TrimMode = iota
	// TrimModeRight is a TrimMode of type Right.
	TrimModeRight
	// TrimModeAll is a TrimMode of type All.
	TrimModeAll
)

func ParseTrimMode

func ParseTrimMode(name string) (TrimMode, error)

ParseTrimMode attempts to convert a string to a TrimMode.

func (TrimMode) MarshalText

func (x TrimMode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (TrimMode) String

func (x TrimMode) String() string

String implements the Stringer interface.

func (TrimMode) TrimWhitespace

func (tm TrimMode) TrimWhitespace() Trim

func (TrimMode) Trimmer

func (tm TrimMode) Trimmer(cutset string) Trim

func (*TrimMode) UnmarshalText

func (x *TrimMode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Trimmer

type Trimmer interface {
	Trim(string) string
}

Jump to

Keyboard shortcuts

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