Class: Rigor::CLI::ProtectionRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/rigor/cli/protection_renderer.rb

Overview

Renders an ProtectionReport (ADR-63 Tier 1) as text or JSON. The text form leads with the protected ratio, then the highest-traffic untyped dispatches (“add a type here”), then the lowest-protected files. The framing is always *where to add a type*, never “your code is broken”.

Constant Summary collapse

TOP_CALLS =
15
TOP_FILES =
10
TRACTABILITY_HINTS =

ADR-73 P6 / ADR-75 WD2 — the actionable axis for each tractability category, shown next to a hole’s origin so a user knows whether (and how) a type can close it.

{
  Inference::DynamicOrigin::ADD_RBS => "add RBS",
  Inference::DynamicOrigin::ENABLE_PLUGIN => "enable a plugin / pre_eval",
  Inference::DynamicOrigin::ENGINE_GAP => "engine gap — report it"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(out:) ⇒ ProtectionRenderer

Returns a new instance of ProtectionRenderer.



26
27
28
# File 'lib/rigor/cli/protection_renderer.rb', line 26

def initialize(out:)
  @out = out
end

Instance Method Details

#render(report, format:) ⇒ Object



30
31
32
# File 'lib/rigor/cli/protection_renderer.rb', line 30

def render(report, format:)
  format == "json" ? render_json(report) : render_text(report)
end