Class: Moult::Report
- Inherits:
-
Object
- Object
- Moult::Report
- Defined in:
- lib/moult/report.rb
Overview
The in-memory result model and the source of the typed JSON output contract. This is one of Moult's two protected APIs (the other being the per-finding confidence model). Every analysis must be swappable behind this shape without changing it; both formatters render from this object so they cannot drift.
The model reserves confidence and category on every finding even though
Phase 1 never populates them: findings are confidence-graded, never asserted
as certain death. Phases 2+ fill these in without a schema_version bump.
Defined Under Namespace
Constant Summary collapse
- SCHEMA_VERSION =
Bump only on a breaking change to the serialized shape.
1
Instance Attribute Summary collapse
-
#churn_since ⇒ Object
readonly
Returns the value of attribute churn_since.
-
#churn_window ⇒ Object
readonly
Returns the value of attribute churn_window.
-
#generated_at ⇒ Object
readonly
Returns the value of attribute generated_at.
-
#git_ref ⇒ Object
readonly
Returns the value of attribute git_ref.
-
#hotspots ⇒ Object
readonly
Returns the value of attribute hotspots.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root:, hotspots:, git_ref: nil, generated_at: nil, churn_window: nil, churn_since: nil) ⇒ Report
constructor
A new instance of Report.
- #to_h ⇒ Object
Constructor Details
#initialize(root:, hotspots:, git_ref: nil, generated_at: nil, churn_window: nil, churn_since: nil) ⇒ Report
Returns a new instance of Report.
25 26 27 28 29 30 31 32 |
# File 'lib/moult/report.rb', line 25 def initialize(root:, hotspots:, git_ref: nil, generated_at: nil, churn_window: nil, churn_since: nil) @root = root @hotspots = hotspots @git_ref = git_ref @generated_at = generated_at @churn_window = churn_window @churn_since = churn_since end |
Instance Attribute Details
#churn_since ⇒ Object (readonly)
Returns the value of attribute churn_since.
17 18 19 |
# File 'lib/moult/report.rb', line 17 def churn_since @churn_since end |
#churn_window ⇒ Object (readonly)
Returns the value of attribute churn_window.
17 18 19 |
# File 'lib/moult/report.rb', line 17 def churn_window @churn_window end |
#generated_at ⇒ Object (readonly)
Returns the value of attribute generated_at.
17 18 19 |
# File 'lib/moult/report.rb', line 17 def generated_at @generated_at end |
#git_ref ⇒ Object (readonly)
Returns the value of attribute git_ref.
17 18 19 |
# File 'lib/moult/report.rb', line 17 def git_ref @git_ref end |
#hotspots ⇒ Object (readonly)
Returns the value of attribute hotspots.
17 18 19 |
# File 'lib/moult/report.rb', line 17 def hotspots @hotspots end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
17 18 19 |
# File 'lib/moult/report.rb', line 17 def root @root end |
Instance Method Details
#to_h ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/moult/report.rb', line 34 def to_h { schema_version: SCHEMA_VERSION, tool: {name: "moult", version: Moult::VERSION}, analysis: { root: root, git_ref: git_ref, generated_at: generated_at, churn: {window: churn_window, since: churn_since} }, hotspots: hotspots.map(&:to_h) } end |