Documentation
¶
Overview ¶
Package rules provides the compatibility rules engine for ccg.
Package rules provides the compatibility rules engine for ccg.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category string
Category represents the category of a finding.
const ( CategoryExecCommand Category = "exec_command" CategoryCGO Category = "cgo" CategoryDynamicLinking Category = "dynamic_linking" CategoryDynamicLink Category = "dynamic_link" CategoryDockerfile Category = "dockerfile" CategoryBaseImage Category = "base_image" CategoryMultiStage Category = "multi_stage" CategoryCorrelation Category = "correlation" )
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the compatibility rules engine that evaluates findings.
func (*Engine) DisableRule ¶
DisableRule disables a rule by ID.
func (*Engine) IsRuleEnabled ¶
IsRuleEnabled returns true if the rule is enabled.
type Finding ¶
type Finding struct {
// RuleID is the unique identifier of the rule that generated this finding.
RuleID string `json:"rule_id"`
// Category is the category of the finding.
Category Category `json:"category"`
// Severity is the severity level of the finding.
Severity Severity `json:"severity"`
// Message is a human-readable description of the finding.
Message string `json:"message"`
// Location is the file and line where the issue was found.
Location Location `json:"location"`
// Details contains additional context about the finding.
Details map[string]interface{} `json:"details,omitempty"`
// Suggestion provides a recommended fix for the issue.
Suggestion string `json:"suggestion,omitempty"`
}
Finding represents a single compatibility issue found during analysis.
type Location ¶
type Location struct {
// File is the path to the file.
File string `json:"file"`
// Line is the line number (1-indexed).
Line int `json:"line,omitempty"`
// Column is the column number (1-indexed).
Column int `json:"column,omitempty"`
// Stage is the Docker build stage name (for multi-stage Dockerfiles).
Stage string `json:"stage,omitempty"`
}
Location represents the location of a finding in source code or configuration.
type Result ¶
type Result struct {
// Findings is the list of all findings.
Findings []Finding `json:"findings"`
// Summary contains aggregated statistics.
Summary Summary `json:"summary"`
// Passed indicates whether the analysis passed (no errors).
Passed bool `json:"passed"`
}
Result represents the overall result of the compatibility analysis.
func (*Result) HasWarnings ¶
HasWarnings returns true if there are any warning-level findings.
type Rule ¶
type Rule struct {
// ID is the unique identifier of the rule.
ID string `json:"id"`
// Name is the human-readable name of the rule.
Name string `json:"name"`
// Description is a detailed description of what the rule checks.
Description string `json:"description"`
// Severity is the default severity of findings from this rule.
Severity Severity `json:"severity"`
// Category is the category this rule belongs to.
Category Category `json:"category"`
// Enabled indicates whether the rule is enabled.
Enabled bool `json:"enabled"`
}
Rule represents a compatibility rule.
type Summary ¶
type Summary struct {
// TotalFindings is the total number of findings.
TotalFindings int `json:"total_findings"`
// ErrorCount is the number of error-level findings.
ErrorCount int `json:"error_count"`
// WarningCount is the number of warning-level findings.
WarningCount int `json:"warning_count"`
// InfoCount is the number of info-level findings.
InfoCount int `json:"info_count"`
// ByCategory contains counts grouped by category.
ByCategory map[Category]int `json:"by_category"`
}
Summary contains aggregated statistics about the findings.