Documentation
¶
Overview ¶
Package scoring computes the per-dimension scores (0-100) and the weighted global score from a set of findings, using the configurable weights from .codefit.yaml (PRD RF-07).
Compute returns a ScoreSummary (per-dimension and weighted global score), and IsBlocked reports whether a critical, unconsented security finding must block the deploy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultWeights ¶
DefaultWeights are the per-dimension score weights from the PRD (RF-07); they sum to 100.
func DimensionScore ¶
DimensionScore returns the 0-100 score for a single dimension's findings: a base of 100 minus the severity penalties of the counting findings, clamped to a floor of 0.
Types ¶
type ScoreSummary ¶
type ScoreSummary struct {
Global int `json:"global"`
ByDimension map[findings.Dimension]*int `json:"by_dimension"`
}
ScoreSummary is the computed result of an audit: the global score and the per-dimension breakdown, each on a 0-100 scale. A dimension whose sensor did not run is "not measured" and reported as nil (JSON null) — distinct from a dimension that was audited and scored 100. The global is re-normalized over the measured dimensions only, so unmeasured dimensions never inflate it (PRD section 21).
func Compute ¶
func Compute(measured []findings.Dimension, fs []findings.Finding, weights map[findings.Dimension]int) ScoreSummary
Compute calculates the per-dimension scores and the weighted global score. Only the dimensions in measured are scored (others are reported as nil, "not measured"); a measured dimension with no findings scores 100. The global is the weighted average over the measured dimensions' weights only.