Lei.ZarfGate (LowEndInsight v0.9.1)

Copy Markdown View Source

Pre-package risk gate for Zarf integration.

Evaluates LEI analysis reports against configurable risk thresholds and returns pass/fail decisions suitable for use as a Zarf action hook or CI/CD gate.

Summary

Functions

Evaluate a single-repo LEI report against a risk threshold.

Returns true if the given risk level exceeds the threshold.

Format gate result as JSON string.

Types

gate_result()

@type gate_result() :: %{
  pass: boolean(),
  threshold: String.t(),
  summary: %{
    total: non_neg_integer(),
    passing: non_neg_integer(),
    failing: non_neg_integer()
  },
  failing_repos: [map()],
  report: map()
}

Functions

evaluate(report, threshold \\ "high")

@spec evaluate(map(), String.t()) :: {:ok, gate_result()}

Evaluate a single-repo LEI report against a risk threshold.

Returns {:ok, result} where result contains :pass boolean and details.

Threshold levels (fail when risk >= threshold)

  • "low" - fail on any risk level (low, medium, high, critical)
  • "medium" - fail on medium, high, or critical risk
  • "high" - fail on high or critical risk (default)
  • "critical" - fail only on critical risk

exceeds_threshold?(risk, threshold)

@spec exceeds_threshold?(String.t(), String.t()) :: boolean()

Returns true if the given risk level exceeds the threshold.

to_json(gate_result)

@spec to_json(map()) :: {:ok, String.t()}

Format gate result as JSON string.