internal

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitLines

func SplitLines(content string) []string

Types

type LintResult

type LintResult struct {
	Passed   bool     `json:"passed"`
	Errors   []Result `json:"errors"`
	Warnings []Result `json:"warnings"`
}

func (*LintResult) Print

func (result *LintResult) Print()

type Linter

type Linter struct {
	Errors   []Rule `json:"errors"`
	Warnings []Rule `json:"warnings"`
}

func (*Linter) Prepare

func (linter *Linter) Prepare(rules []Rule)

func (*Linter) PrepareByContent

func (linter *Linter) PrepareByContent(content string)

func (*Linter) PrepareByFile

func (linter *Linter) PrepareByFile(filepath string)

func (*Linter) Run

func (linter *Linter) Run(content string) LintResult

type Match

type Match struct {
	StartIndex int    `json:"start"`
	EndIndex   int    `json:"end"`
	Message    string `json:"message"`
}

type Result

type Result struct {
	Matches []Match `json:"matches"`
	Help    string  `json:"help"`
	Name    string  `json:"name"`
}

func Analyze

func Analyze(lines []string, rules []Rule) []Result

type Rule

type Rule struct {
	DetectionsRegex []regexp.Regexp
	Detections      []string `json:"detections"`
	Help            string   `json:"help"`
	Type            string   `json:"type"`
	Name            string   `json:"name"`
}

func LoadRules

func LoadRules(filename string) ([]Rule, error)

func LoadRulesByContent

func LoadRulesByContent(content string) ([]Rule, error)

func (*Rule) Build

func (rule *Rule) Build()

func (*Rule) IsError

func (rule *Rule) IsError() bool

func (*Rule) Match

func (rule *Rule) Match(lines []string, fromIndex int) (*Match, bool)

func (*Rule) Matches

func (rule *Rule) Matches(lines []string) (*Result, bool)

Jump to

Keyboard shortcuts

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