validation

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package validation provides production readiness validation and reporting

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	ErrRunnerCreationFailed = errors.New("failed to create runner with provided configuration")
)

Error variables

Functions

This section is empty.

Types

type CICompatibility

type CICompatibility struct {
	GitHubActions      bool     `json:"github_actions"`
	GitLabCI           bool     `json:"gitlab_ci"`
	Jenkins            bool     `json:"jenkins"`
	GenericCI          bool     `json:"generic_ci"`
	NetworkConstrained bool     `json:"network_constrained"`
	ResourceLimited    bool     `json:"resource_limited"`
	Issues             []string `json:"issues"`
	Score              int      `json:"score"` // 0-100
}

CICompatibility contains CI environment validation results

type ConfigurationHealth

type ConfigurationHealth struct {
	LoadsSuccessfully     bool     `json:"loads_successfully"`
	ValidatesCorrectly    bool     `json:"validates_correctly"`
	DefaultsAppropriate   bool     `json:"defaults_appropriate"`
	EnvironmentPrecedence bool     `json:"environment_precedence"`
	ErrorHandling         bool     `json:"error_handling"`
	DocumentationComplete bool     `json:"documentation_complete"`
	Issues                []string `json:"issues"`
	Score                 int      `json:"score"` // 0-100
}

ConfigurationHealth contains configuration validation results

type ParallelSafety

type ParallelSafety struct {
	ConcurrentExecution bool     `json:"concurrent_execution"`
	MemoryManagement    bool     `json:"memory_management"`
	ResourceCleanup     bool     `json:"resource_cleanup"`
	RaceConditions      bool     `json:"race_conditions"`
	ContextCancellation bool     `json:"context_cancellation"`
	ConsistentResults   bool     `json:"consistent_results"`
	Issues              []string `json:"issues"`
	Score               int      `json:"score"` // 0-100
}

ParallelSafety contains parallel execution validation results

type PerformanceMetrics

type PerformanceMetrics struct {
	SmallCommitAvg   time.Duration `json:"small_commit_avg"`
	TypicalCommitAvg time.Duration `json:"typical_commit_avg"`
	ColdStartTime    time.Duration `json:"cold_start_time"`
	WarmRunTime      time.Duration `json:"warm_run_time"`
	MeetsTargetTime  bool          `json:"meets_target_time"`
	ParallelScaling  bool          `json:"parallel_scaling"`
	MemoryEfficient  bool          `json:"memory_efficient"`
	Score            int           `json:"score"` // 0-100
}

PerformanceMetrics contains performance validation results

type ProductionReadinessReport

type ProductionReadinessReport struct {
	// Metadata
	GeneratedAt time.Time `json:"generated_at"`
	Version     string    `json:"version"`
	Environment string    `json:"environment"`

	// System Information
	SystemInfo SystemInfo `json:"system_info"`

	// Validation Results
	PerformanceMetrics  PerformanceMetrics  `json:"performance_metrics"`
	ConfigurationHealth ConfigurationHealth `json:"configuration_health"`
	CICompatibility     CICompatibility     `json:"ci_compatibility"`
	ParallelSafety      ParallelSafety      `json:"parallel_safety"`
	ProductionScenarios ProductionScenarios `json:"production_scenarios"`
	SkipFunctionality   SkipFunctionality   `json:"skip_functionality"`

	// Overall Assessment
	OverallScore     int      `json:"overall_score"` // 0-100
	ProductionReady  bool     `json:"production_ready"`
	CriticalIssues   []string `json:"critical_issues"`
	Recommendations  []string `json:"recommendations"`
	KnownLimitations []string `json:"known_limitations"`
}

ProductionReadinessReport represents a comprehensive validation report

func (*ProductionReadinessReport) FormatReport

func (r *ProductionReadinessReport) FormatReport() string

FormatReport formats the report as a human-readable string

Example

Example usage test

report := &ProductionReadinessReport{
	GeneratedAt:     time.Date(2025, 1, 1, 12, 0, 0, 0, time.UTC),
	Version:         "1.0.0",
	Environment:     "example",
	OverallScore:    95,
	ProductionReady: true,
	SystemInfo: SystemInfo{
		GoVersion:    "go1.21.0",
		OS:           "linux",
		Architecture: "amd64",
		NumCPU:       8,
	},
	PerformanceMetrics: PerformanceMetrics{
		Score:           90,
		SmallCommitAvg:  1 * time.Second,
		MeetsTargetTime: true,
	},
}

formatted := report.FormatReport()
lines := strings.Split(formatted, "\n")

// Print first few lines as example
for i := 0; i < 5 && i < len(lines); i++ {
	fmt.Println(lines[i])
}
Output:

# GoFortress Pre-commit System - Production Readiness Report

Generated: 2025-01-01T12:00:00Z
Version: 1.0.0
Environment: example

type ProductionReadinessValidator

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

ProductionReadinessValidator validates the system for production readiness

func NewProductionReadinessValidator

func NewProductionReadinessValidator() (*ProductionReadinessValidator, error)

NewProductionReadinessValidator creates a new validator

func (*ProductionReadinessValidator) Cleanup

func (v *ProductionReadinessValidator) Cleanup()

Cleanup cleans up temporary resources

func (*ProductionReadinessValidator) GenerateReport

GenerateReport generates a comprehensive production readiness report

type ProductionScenarios

type ProductionScenarios struct {
	LargeRepositories   bool     `json:"large_repositories"`
	MixedFileTypes      bool     `json:"mixed_file_types"`
	HighVolumeCommits   bool     `json:"high_volume_commits"`
	RealWorldPatterns   bool     `json:"real_world_patterns"`
	ResourceConstraints bool     `json:"resource_constraints"`
	NetworkIssues       bool     `json:"network_issues"`
	Issues              []string `json:"issues"`
	Score               int      `json:"score"` // 0-100
}

ProductionScenarios contains production scenario validation results

type Service added in v1.0.1

type Service struct{}

Service provides validation functionality for the pre-commit system

type SkipFunctionality

type SkipFunctionality struct {
	SingleCheckSkip   bool     `json:"single_check_skip"`
	MultipleCheckSkip bool     `json:"multiple_check_skip"`
	InvalidCheckNames bool     `json:"invalid_check_names"`
	EnvironmentVars   bool     `json:"environment_vars"`
	CIIntegration     bool     `json:"ci_integration"`
	EdgeCases         bool     `json:"edge_cases"`
	Issues            []string `json:"issues"`
	Score             int      `json:"score"` // 0-100
}

SkipFunctionality contains SKIP functionality validation results

type SystemInfo

type SystemInfo struct {
	GoVersion    string `json:"go_version"`
	OS           string `json:"os"`
	Architecture string `json:"architecture"`
	NumCPU       int    `json:"num_cpu"`
}

SystemInfo contains system information

Jump to

Keyboard shortcuts

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