a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
48 lines
1.5 KiB
Go
48 lines
1.5 KiB
Go
package analysis
|
|
|
|
import (
|
|
"github.com/zzet/gortex/internal/config"
|
|
"github.com/zzet/gortex/internal/graph"
|
|
)
|
|
|
|
// RuleFamily is one pluggable body of change-gate rules. Guards, architecture,
|
|
// event boundaries, and (in the security theme) taint all implement it, so the
|
|
// change_contract evaluator runs "every registered family over the changed
|
|
// set" instead of hard-wiring each evaluator by hand. Adding a rule family is
|
|
// then a registration, not a new branch in the pipeline.
|
|
type RuleFamily interface {
|
|
// Name identifies the family for provenance on each finding.
|
|
Name() string
|
|
// Evaluate checks a set of changed symbol IDs against the family's rules
|
|
// and returns the violations, each carrying its own severity.
|
|
Evaluate(g graph.Store, changedSet []string) []GuardViolation
|
|
}
|
|
|
|
// GuardsFamily adapts the flat guards: list (co-change / boundary rules).
|
|
type GuardsFamily struct {
|
|
Rules []config.GuardRule
|
|
}
|
|
|
|
func (f GuardsFamily) Name() string { return "guards" }
|
|
|
|
func (f GuardsFamily) Evaluate(g graph.Store, changedSet []string) []GuardViolation {
|
|
if len(f.Rules) == 0 {
|
|
return nil
|
|
}
|
|
return EvaluateGuards(g, f.Rules, changedSet)
|
|
}
|
|
|
|
// ArchitectureFamily adapts the declarative architecture: layer DSL.
|
|
type ArchitectureFamily struct {
|
|
Config config.ArchitectureConfig
|
|
}
|
|
|
|
func (f ArchitectureFamily) Name() string { return "architecture" }
|
|
|
|
func (f ArchitectureFamily) Evaluate(g graph.Store, changedSet []string) []GuardViolation {
|
|
if f.Config.IsEmpty() {
|
|
return nil
|
|
}
|
|
return EvaluateArchitecture(g, f.Config, changedSet)
|
|
}
|