types

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigRule

type ConfigRule struct {
	Severity Severity    `yaml:"severity"`
	Data     interface{} `yaml:"data"` // Data can be anything
}

Rule represents an individual rule with an ID and severity.

type Issue

type Issue struct {
	Rule       string         `json:"rule"`
	Category   string         `json:"category"`
	Filename   string         `json:"filename"`
	Message    string         `json:"message"`
	Suggestion string         `json:"suggestion"`
	Note       string         `json:"note"`
	Start      token.Position `json:"start"`
	End        token.Position `json:"end"`
	Confidence float64        `json:"confidence"` // 0.0 to 1.0
	Severity   Severity       `json:"severity"`
}

Issue represents a lint issue found in the code base.

func (*Issue) MarshalJSON

func (i *Issue) MarshalJSON() ([]byte, error)

func (Issue) String

func (i Issue) String() string

type IssueWithoutFilename

type IssueWithoutFilename struct {
	Rule       string                  `json:"rule"`
	Category   string                  `json:"category"`
	Message    string                  `json:"message"`
	Suggestion string                  `json:"suggestion"`
	Note       string                  `json:"note"`
	Start      PositionWithoutFilename `json:"start"`
	End        PositionWithoutFilename `json:"end"`
	Confidence float64                 `json:"confidence"`
	Severity   Severity                `json:"severity"`
}

type PositionWithoutFilename

type PositionWithoutFilename struct {
	Offset int `json:"offset"`
	Line   int `json:"line"`
	Column int `json:"column"`
}

PositionWithoutFilename represents a position in the code base without the filename to simplify json marsheling.

type Severity

type Severity int // Severity of the lint rule
const (
	SeverityError Severity = iota
	SeverityWarning
	SeverityInfo
	SeverityOff
)

func (Severity) MarshalJSON

func (s Severity) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Severity to JSON as a string.

func (Severity) String

func (s Severity) String() string

func (Severity) UnmarshalJSON

func (s Severity) UnmarshalJSON(data []byte) error

func (*Severity) UnmarshalYAML

func (s *Severity) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals the Severity from YAML as a string.

Jump to

Keyboard shortcuts

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