guard

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Path     string   `json:"path"`
	Line     int      `json:"line"`
	Rule     string   `json:"rule"`
	Category string   `json:"category"`
	Severity Severity `json:"severity"`
	Message  string   `json:"message"`
	Match    string   `json:"match,omitempty"`
}

type Options

type Options struct {
	Root          string
	Paths         []string
	BlockPatterns []string
}

type Report

type Report struct {
	FilesScanned       int            `json:"files_scanned"`
	FilesSkipped       int            `json:"files_skipped"`
	FindingsByCategory map[string]int `json:"findings_by_category,omitempty"`
	SkippedByReason    map[string]int `json:"skipped_by_reason,omitempty"`
	Findings           []Finding      `json:"findings"`
	Skipped            []SkippedFile  `json:"skipped,omitempty"`
}

func Scan

func Scan(opts Options) (Report, error)

func ScanContractAware

func ScanContractAware(root string, spec *contract.Contract, paths []string) (Report, error)

func (Report) HasSeverity

func (r Report) HasSeverity(min Severity) bool

type Rule

type Rule struct {
	Name     string
	Category string
	Severity Severity
	Message  string
	Pattern  *regexp.Regexp
}

type Severity

type Severity string
const (
	SeverityWarn  Severity = "warn"
	SeverityError Severity = "error"
)

type SkippedFile

type SkippedFile struct {
	Path   string `json:"path"`
	Reason string `json:"reason"`
}

Jump to

Keyboard shortcuts

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