rules

package
v0.0.0-...-bbb0290 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const LockFileName = "rules.lock.json"

Variables

This section is empty.

Functions

func FormatLoadStats

func FormatLoadStats(scanner Scanner) []string

func PrintList

func PrintList(w io.Writer, rulesDir string, showLicense, showSource bool) error

func Status

func Status(rulesDir string) (*core.RuleBundleInfo, error)

func WriteLicenseSummary

func WriteLicenseSummary(rulesDir string, lock *LockFile) error

Types

type LockEntry

type LockEntry struct {
	Path       string `json:"path"`
	SHA256     string `json:"sha256"`
	Size       int64  `json:"size"`
	License    string `json:"license"`
	SourceName string `json:"source_name"`
	Compatible bool   `json:"compatible"`
}

type LockFile

type LockFile struct {
	Version   string       `json:"version"`
	UpdatedAt string       `json:"updated_at"`
	Sources   []LockSource `json:"sources"`
	Files     []LockEntry  `json:"files"`
}

func ReadLock

func ReadLock(rulesDir string) (*LockFile, error)

func Update

func Update(ctx context.Context, rulesDir string, sources *config.RuleSourcesConfig) (*LockFile, error)

type LockSource

type LockSource struct {
	Name        string `json:"name"`
	Source      string `json:"source"`
	URL         string `json:"url"`
	License     string `json:"license"`
	Destination string `json:"destination"`
	ETag        string `json:"etag,omitempty"`
	Enabled     bool   `json:"enabled"`
}

type RuleLoadStat

type RuleLoadStat struct {
	Category     string
	Files        int
	Rules        int
	SkippedFiles int
}

type Scanner

type Scanner interface {
	Scan(content []byte) []string
	ScanFile(path string, content []byte) []string
	Count() int
	Engine() string
	Stats() []RuleLoadStat
}

func LoadScanner

func LoadScanner(rulesDir, group string) (Scanner, string, error)

type VerifyResult

type VerifyResult struct {
	OK       bool
	Errors   []string
	Warnings []string
	Lock     *LockFile
}

func Verify

func Verify(rulesDir string) VerifyResult

Jump to

Keyboard shortcuts

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