rules

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	RuleSupplyContract     = "RULE_SUPPLY_CONTRACT"
	RuleLogicLevelContract = "RULE_LOGIC_LEVEL_CONTRACT"
	RuleBusRoleContract    = "RULE_BUS_ROLE_CONTRACT"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BusRoleContractRule added in v0.2.8

type BusRoleContractRule struct{}

BusRoleContractRule checks obvious bus-role conflicts without guessing when contracts are incomplete.

func (BusRoleContractRule) Check added in v0.2.8

func (r BusRoleContractRule) Check(design *ir.DesignIR, contractIR *contracts.ContractIR) []Finding

func (BusRoleContractRule) ID added in v0.2.8

type Finding added in v0.2.8

type Finding struct {
	RuleID   string              `json:"rule_id"`
	Severity string              `json:"severity"`
	Net      string              `json:"net,omitempty"`
	Message  string              `json:"message"`
	Provider string              `json:"provider,omitempty"`
	Consumer string              `json:"consumer,omitempty"`
	Ref      string              `json:"ref,omitempty"`
	Pin      string              `json:"pin,omitempty"`
	Expected *contracts.Evidence `json:"expected,omitempty"`
	Observed *contracts.Evidence `json:"observed,omitempty"`
}

Finding is the rule-engine result type before it is adapted into report JSON.

func CheckAll added in v0.2.8

func CheckAll(design *ir.DesignIR, contractIR *contracts.ContractIR, ruleSet []Rule) []Finding

CheckAll runs rules and normalizes their rule IDs and ordering.

type LogicLevelContractRule added in v0.2.8

type LogicLevelContractRule struct{}

LogicLevelContractRule catches signal outputs that exceed contracted input logic tolerance, for example 5 V GPIO into a 3.3 V-only input.

func (LogicLevelContractRule) Check added in v0.2.8

func (r LogicLevelContractRule) Check(design *ir.DesignIR, contractIR *contracts.ContractIR) []Finding

func (LogicLevelContractRule) ID added in v0.2.8

type Rule added in v0.2.8

type Rule interface {
	ID() string
	Check(design *ir.DesignIR, contracts *contracts.ContractIR) []Finding
}

Rule is the only interface rule implementations need. It deliberately exposes DesignIR + ContractIR and nothing from any importer package.

func DefaultRules added in v0.2.8

func DefaultRules() []Rule

DefaultRules returns the scan-time contract rule set.

type SupplyContractRule added in v0.2.8

type SupplyContractRule struct{}

SupplyContractRule compares power providers on a net with power consumers on the same net. It reports only when contracts contain enough voltage data.

func (SupplyContractRule) Check added in v0.2.8

func (r SupplyContractRule) Check(design *ir.DesignIR, contractIR *contracts.ContractIR) []Finding

func (SupplyContractRule) ID added in v0.2.8

Jump to

Keyboard shortcuts

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