auditpattern

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReportsJSON

func ReportsJSON(reports []Report) ([]byte, error)

Types

type Fixture

type Fixture struct {
	Name            string `yaml:"name" json:"name"`
	Path            string `yaml:"path" json:"path"`
	WantGNOTest     string `yaml:"want_gno_test" json:"want_gno_test"`
	WantPatternHits int    `yaml:"want_pattern_hits" json:"want_pattern_hits"`
}

type FixtureResult

type FixtureResult struct {
	Name                 string   `json:"name"`
	Path                 string   `json:"path"`
	PathOK               bool     `json:"path_ok"`
	GNOTestOK            bool     `json:"gno_test_ok"`
	GNOTestWant          string   `json:"gno_test_want"`
	GNOTestOutput        string   `json:"gno_test_output"`
	PatternHits          []Hit    `json:"pattern_hits"`
	WantPatternHits      int      `json:"want_pattern_hits"`
	PatternExpectationOK bool     `json:"pattern_expectation_ok"`
	Errors               []string `json:"errors,omitempty"`
}

type Hit

type Hit struct {
	File string `json:"file"`
	Line int    `json:"line"`
	Text string `json:"text"`
}

func RunRule

func RunRule(rule, dir string) ([]Hit, error)

type Options

type Options struct {
	GNOBin string
}

type Record

type Record struct {
	ID       string    `yaml:"id" json:"id"`
	Title    string    `yaml:"title" json:"title"`
	Rule     string    `yaml:"rule" json:"rule"`
	Fixtures []Fixture `yaml:"fixtures" json:"fixtures"`
}

func LoadRecord

func LoadRecord(path string) (Record, error)

func (Record) ValidatePaths

func (rec Record) ValidatePaths() error

ValidatePaths checks that every fixture path exists and is a directory.

type Report

type Report struct {
	ID       string          `json:"id"`
	Title    string          `json:"title"`
	Rule     string          `json:"rule"`
	OK       bool            `json:"ok"`
	Fixtures []FixtureResult `json:"fixtures"`
}

func Run

func Run(ctx context.Context, rec Record, opts Options) Report

func (Report) Markdown

func (report Report) Markdown() string

Jump to

Keyboard shortcuts

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