engine

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalysisResult

type AnalysisResult struct {
	Workflows        []*platform.Workflow `json:"workflows"`
	GoFindings       []rules.Finding      `json:"go_findings"`
	OPAFindings      []opa.Finding        `json:"opa_findings"`
	CombinedFindings []rules.Finding      `json:"combined_findings"`
	Statistics       Statistics           `json:"statistics"`
	Performance      PerformanceMetrics   `json:"performance"`
}

AnalysisResult represents the combined analysis results

type Config

type Config struct {
	EnableGoRules   bool            `json:"enable_go_rules"`
	EnableOPARules  bool            `json:"enable_opa_rules"`
	GoRulesConfig   GoRulesConfig   `json:"go_rules_config"`
	OPARulesConfig  OPARulesConfig  `json:"opa_rules_config"`
	PlatformConfig  PlatformConfig  `json:"platform_config"`
	ReportingConfig ReportingConfig `json:"reporting_config"`
}

Config defines configuration for the hybrid engine

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a default configuration

type GoRulesConfig

type GoRulesConfig struct {
	EnabledCategories []rules.Category `json:"enabled_categories"`
	DisabledRules     []string         `json:"disabled_rules"`
	CustomRules       []string         `json:"custom_rules"`
	PerformanceMode   bool             `json:"performance_mode"`
}

GoRulesConfig configures Go-based rule execution

type HybridEngine

type HybridEngine struct {
	// contains filtered or unexported fields
}

HybridEngine combines Go-native rules with OPA policies

func NewHybridEngine

func NewHybridEngine(config Config) (*HybridEngine, error)

NewHybridEngine creates a new hybrid engine

func (*HybridEngine) AnalyzeRepository

func (he *HybridEngine) AnalyzeRepository(repoPath string) (*AnalysisResult, error)

AnalyzeRepository analyzes a repository with both Go rules and OPA policies

func (*HybridEngine) AnalyzeWorkflow

func (he *HybridEngine) AnalyzeWorkflow(workflowPath string) (*AnalysisResult, error)

AnalyzeWorkflow analyzes a single workflow file

func (*HybridEngine) GetGoRules

func (he *HybridEngine) GetGoRules() []rules.Rule

GetGoRules returns available Go rules

func (*HybridEngine) GetOPAPolicies

func (he *HybridEngine) GetOPAPolicies() map[string]*opa.Policy

GetOPAPolicies returns loaded OPA policies

func (*HybridEngine) GetSupportedPlatforms

func (he *HybridEngine) GetSupportedPlatforms() []string

GetSupportedPlatforms returns list of supported platforms

type OPARulesConfig

type OPARulesConfig struct {
	PolicyPaths    []string `json:"policy_paths"`
	CustomPolicies []string `json:"custom_policies"`
	StrictMode     bool     `json:"strict_mode"`
}

OPARulesConfig configures OPA policy execution

type PerformanceMetrics

type PerformanceMetrics struct {
	TotalExecutionTimeMs int64 `json:"total_execution_time_ms"`
	GoRulesTimeMs        int64 `json:"go_rules_time_ms"`
	OPATimeMs            int64 `json:"opa_time_ms"`
	PlatformDetectionMs  int64 `json:"platform_detection_ms"`
	WorkflowParsingMs    int64 `json:"workflow_parsing_ms"`
}

PerformanceMetrics tracks execution performance

type PlatformConfig

type PlatformConfig struct {
	AutoDetect         bool     `json:"auto_detect"`
	SupportedPlatforms []string `json:"supported_platforms"`
	PreferredPlatform  string   `json:"preferred_platform"`
}

PlatformConfig configures platform support

type ReportingConfig

type ReportingConfig struct {
	Format          string `json:"format"`
	IncludeMetadata bool   `json:"include_metadata"`
	Verbose         bool   `json:"verbose"`
}

ReportingConfig configures output and reporting

type Statistics

type Statistics struct {
	TotalWorkflows      int                    `json:"total_workflows"`
	PlatformBreakdown   map[string]int         `json:"platform_breakdown"`
	FindingsByCategory  map[rules.Category]int `json:"findings_by_category"`
	FindingsBySeverity  map[rules.Severity]int `json:"findings_by_severity"`
	GoRulesExecuted     int                    `json:"go_rules_executed"`
	OPAPoliciesExecuted int                    `json:"opa_policies_executed"`
}

Statistics provides analysis statistics

Jump to

Keyboard shortcuts

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