Class: Moult::CyclesReport
- Inherits:
-
Object
- Object
- Moult::CyclesReport
- Defined in:
- lib/moult/cycles_report.rb
Overview
The serialized result model for moult cycles (schema/cycles.schema.json),
sibling to DuplicationReport and DeadCodeReport. Each Finding is one
strongly-connected component of the file dependency graph, carrying the
resolved constant-reference edges as its evidence.
Defined Under Namespace
Classes: Finding
Constant Summary collapse
- SCHEMA_VERSION =
Bump only on a breaking change to the serialized shape.
1
Instance Attribute Summary collapse
-
#backend ⇒ Object
readonly
Returns the value of attribute backend.
-
#backend_version ⇒ Object
readonly
Returns the value of attribute backend_version.
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#findings ⇒ Object
readonly
Returns the value of attribute findings.
-
#generated_at ⇒ Object
readonly
Returns the value of attribute generated_at.
-
#git_ref ⇒ Object
readonly
Returns the value of attribute git_ref.
-
#resolved ⇒ Object
readonly
Returns the value of attribute resolved.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
-
#initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "rubydex", backend_version: nil, resolved: true, diagnostics: []) ⇒ CyclesReport
constructor
A new instance of CyclesReport.
-
#summary ⇒ Hash
Aggregate counts across all cycles.
- #to_h ⇒ Object
Constructor Details
#initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "rubydex", backend_version: nil, resolved: true, diagnostics: []) ⇒ CyclesReport
Returns a new instance of CyclesReport.
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/moult/cycles_report.rb', line 37 def initialize(root:, findings:, git_ref: nil, generated_at: nil, backend: "rubydex", backend_version: nil, resolved: true, diagnostics: []) @root = root @findings = findings @git_ref = git_ref @generated_at = generated_at @backend = backend @backend_version = backend_version @resolved = resolved @diagnostics = diagnostics end |
Instance Attribute Details
#backend ⇒ Object (readonly)
Returns the value of attribute backend.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def backend @backend end |
#backend_version ⇒ Object (readonly)
Returns the value of attribute backend_version.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def backend_version @backend_version end |
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def diagnostics @diagnostics end |
#findings ⇒ Object (readonly)
Returns the value of attribute findings.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def findings @findings end |
#generated_at ⇒ Object (readonly)
Returns the value of attribute generated_at.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def generated_at @generated_at end |
#git_ref ⇒ Object (readonly)
Returns the value of attribute git_ref.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def git_ref @git_ref end |
#resolved ⇒ Object (readonly)
Returns the value of attribute resolved.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def resolved @resolved end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
30 31 32 |
# File 'lib/moult/cycles_report.rb', line 30 def root @root end |
Instance Method Details
#summary ⇒ Hash
Returns aggregate counts across all cycles.
50 51 52 53 54 55 56 |
# File 'lib/moult/cycles_report.rb', line 50 def summary { cycles: findings.size, files: findings.sum { |f| f.files.size }, largest: findings.map(&:size).max || 0 } end |
#to_h ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/moult/cycles_report.rb', line 58 def to_h { schema_version: SCHEMA_VERSION, tool: {name: "moult", version: Moult::VERSION}, analysis: { root: root, git_ref: git_ref, generated_at: generated_at, index: { backend: backend, backend_version: backend_version, resolved: resolved, diagnostics: diagnostics } }, summary: summary, findings: findings.map(&:to_h) } end |